From c3d6ac0e3dfb24335735ed9bface91ffe7caaf20 Mon Sep 17 00:00:00 2001 From: "eugene.livis" Date: Wed, 28 Sep 2022 10:40:55 -0400 Subject: [PATCH] Better fix --- .../CentralRepositoryNotificationDialog.java | 19 +++++++++++++++---- .../autopsy/core/RuntimeProperties.java | 15 ++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CentralRepositoryNotificationDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CentralRepositoryNotificationDialog.java index 883d979c90..542f7b0d16 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CentralRepositoryNotificationDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CentralRepositoryNotificationDialog.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2020 Basis Technology Corp. + * Copyright 2020-2022 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,11 +30,22 @@ import org.sleuthkit.autopsy.coreutils.Version; public class CentralRepositoryNotificationDialog { /** - * This dialog should display iff the mode is RELEASE and the - * application is running with a GUI. + * This dialog should display if the mode is RELEASE and the application is + * running with a GUI. In addition to the Autopsy flag setting, it also + * checks whether the AUTOPSY_HEADLESS environment variable is set. The + * environment variable is set by some of the projects built on top of + * Autopsy platform. This is necessary because sometimes this method is + * called from Installer classes, i.e. before we have been able to determine + * whether we are running headless or not. See JIRA-8422. */ static boolean shouldDisplay() { - return Version.getBuildType() == Version.Type.RELEASE + if (System.getenv("AUTOPSY_HEADLESS") != null) { + // Some projects built on top of Autopsy platform set this environment + // variable to make sure there are no UI popups + return false; + } + + return Version.getBuildType() == Version.Type.RELEASE && RuntimeProperties.runningWithGUI(); } diff --git a/Core/src/org/sleuthkit/autopsy/core/RuntimeProperties.java b/Core/src/org/sleuthkit/autopsy/core/RuntimeProperties.java index fc1fdf9f1a..ab25f1f6ce 100644 --- a/Core/src/org/sleuthkit/autopsy/core/RuntimeProperties.java +++ b/Core/src/org/sleuthkit/autopsy/core/RuntimeProperties.java @@ -76,23 +76,12 @@ public class RuntimeProperties { /** * Gets a flag indicating whether or not the application is running with a - * GUI. In addition to the Autopsy flag setting, it also checks whether the - * AUTOPSY_HEADLESS environment variable is set. The environment variable is set - * by some of the projects built on top of Autopsy platform. This is necessary - * because sometimes this method is called from Installer classes, i.e. before - * we have been able to determine whether we are running headless or not. - * See JIRA-8422. + * GUI. * * @return True or false. */ public synchronized static boolean runningWithGUI() { - if (System.getenv("AUTOPSY_HEADLESS") != null) { - // Some projects built on top of Autopsy platform set this environment - // variable to make sure there are no UI popups - return false; - } else { - return runningWithGUI; - } + return runningWithGUI; } /**