From b7db91c963e6d09c116a2c214767b97946cd5709 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Thu, 6 Aug 2020 17:04:57 -0400 Subject: [PATCH] Fixed doubling cr hashset issue --- .../HashDatabaseOptionsPanelController.java | 5 +++- .../modules/hashdatabase/HashDbManager.java | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java index 41de451c67..4d15c43bd1 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java @@ -72,7 +72,10 @@ public final class HashDatabaseOptionsPanelController extends OptionsPanelContro */ @Override public void cancel() { - getPanel().cancel(); + if(changed) { + getPanel().cancel(); + changed = false; + } } @Override diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java index 139edb8ec7..40544c5485 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java @@ -326,17 +326,19 @@ public class HashDbManager implements PropertyChangeListener { } // Add the hash database to the collection - hashSets.add(db); - - // Let any external listeners know that there's a new set - try { - changeSupport.firePropertyChange(SetEvt.DB_ADDED.toString(), null, hashSetName); - } catch (Exception e) { - logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); //NON-NLS - MessageNotifyUtil.Notify.show( - NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"), - NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"), - MessageNotifyUtil.MessageType.ERROR); + if(!hashSets.contains(db)) { + hashSets.add(db); + + // Let any external listeners know that there's a new set + try { + changeSupport.firePropertyChange(SetEvt.DB_ADDED.toString(), null, hashSetName); + } catch (Exception e) { + logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); //NON-NLS + MessageNotifyUtil.Notify.show( + NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"), + NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"), + MessageNotifyUtil.MessageType.ERROR); + } } return db;