From 3e7b345418ddcea4ae14898fafec90b4e031afab Mon Sep 17 00:00:00 2001 From: millmanorama Date: Wed, 19 Sep 2018 20:18:44 +0200 Subject: [PATCH] remove synchronized block --- .../ImageGalleryTopComponent.java | 69 +++++++++---------- .../datamodel/grouping/GroupManager.java | 3 +- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java index 055b0cc623..a1238185ea 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java @@ -344,49 +344,48 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl + "or no groups are fully analyzed but ingest is not running."}) private void checkForGroups() { GroupManager groupManager = controller.getGroupManager(); - synchronized (groupManager) { - if (isNotEmpty(groupManager.getAnalyzedGroups())) { - clearNotification(); - return; - } - if (IngestManager.getInstance().isIngestRunning()) { + if (isNotEmpty(groupManager.getAnalyzedGroups())) { + clearNotification(); + return; + } + + if (IngestManager.getInstance().isIngestRunning()) { + if (controller.isListeningEnabled()) { + replaceNotification(centralStack, + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg2(), + new ProgressIndicator())); + } else { + replaceNotification(fullUIStack, + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg1())); + } + return; + } + if (controller.getDBTasksQueueSizeProperty().get() > 0) { + replaceNotification(fullUIStack, + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(), + new ProgressIndicator())); + return; + } + try { + if (controller.getDatabase().countAllFiles() <= 0) { + // there are no files in db if (controller.isListeningEnabled()) { - replaceNotification(centralStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg2(), - new ProgressIndicator())); + replaceNotification(fullUIStack, + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg5())); } else { replaceNotification(fullUIStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg1())); + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg4())); } return; } - if (controller.getDBTasksQueueSizeProperty().get() > 0) { - replaceNotification(fullUIStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg3(), - new ProgressIndicator())); - return; - } - try { - if (controller.getDatabase().countAllFiles() <= 0) { - // there are no files in db - if (controller.isListeningEnabled()) { - replaceNotification(fullUIStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg5())); - } else { - replaceNotification(fullUIStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg4())); - } - return; - } - } catch (TskCoreException tskCoreException) { - logger.log(Level.SEVERE, "Error counting files in the database.", tskCoreException); - } + } catch (TskCoreException tskCoreException) { + logger.log(Level.SEVERE, "Error counting files in the database.", tskCoreException); + } - if (false == groupManager.isRegrouping()) { - replaceNotification(centralStack, - new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6())); - } + if (false == groupManager.isRegrouping()) { + replaceNotification(centralStack, + new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6())); } } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java index f36e3b66f2..1d5b5322e6 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java @@ -226,9 +226,8 @@ public class GroupManager { } public boolean isRegrouping() { - Worker.State state = regrouper.getState(); return Arrays.asList(Worker.State.READY, Worker.State.RUNNING, Worker.State.SCHEDULED) - .contains(state); + .contains(regrouper.getState()); } public ReadOnlyObjectProperty reGroupingState() {