From 6f191ee5a964abc87fadaa2db61c07590e80c93a Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Thu, 23 Jul 2020 10:52:05 -0400 Subject: [PATCH] correcting uses of getAllHashSets --- .../modules/hashdatabase/HashDbManager.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java index adc453c65f..139edb8ec7 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java @@ -433,7 +433,7 @@ public class HashDbManager implements PropertyChangeListener { void save() throws HashDbManagerException { try { - if (!HashLookupSettings.writeSettings(new HashLookupSettings(HashLookupSettings.convertHashSetList(getNonOfficialHashSets())))) { + if (!HashLookupSettings.writeSettings(new HashLookupSettings(HashLookupSettings.convertHashSetList(this.hashSets)))) { throw new HashDbManagerException(NbBundle.getMessage(this.getClass(), "HashDbManager.saveErrorExceptionMsg")); } } catch (HashLookupSettings.HashLookupSettingsException ex) { @@ -492,13 +492,6 @@ public class HashDbManager implements PropertyChangeListener { return getUpdateableHashSets(getAllHashSets()); } - private List getNonOfficialHashSets() { - return getAllHashSets() - .stream() - .filter((HashDb db) -> (db instanceof SleuthkitHashSet && ((SleuthkitHashSet) db).isOfficialSet()) ? false : true) - .collect(Collectors.toList()); - } - private List getUpdateableHashSets(List hashDbs) { return hashDbs .stream() @@ -539,7 +532,7 @@ public class HashDbManager implements PropertyChangeListener { * cancellation of configuration panels. */ public synchronized void loadLastSavedConfiguration() { - closeHashDatabases(getAllHashSets()); + closeHashDatabases(this.hashSets); hashSetNames.clear(); hashSetPaths.clear(); @@ -765,7 +758,7 @@ public class HashDbManager implements PropertyChangeListener { */ if (!allDatabasesLoadedCorrectly && RuntimeProperties.runningWithGUI()) { try { - HashLookupSettings.writeSettings(new HashLookupSettings(HashLookupSettings.convertHashSetList(getNonOfficialHashSets()))); + HashLookupSettings.writeSettings(new HashLookupSettings(HashLookupSettings.convertHashSetList(this.hashSets))); allDatabasesLoadedCorrectly = true; } catch (HashLookupSettings.HashLookupSettingsException ex) { allDatabasesLoadedCorrectly = false; @@ -839,7 +832,7 @@ public class HashDbManager implements PropertyChangeListener { } private boolean hashDbInfoIsNew(HashDbInfo dbInfo) { - for (HashDb db : getAllHashSets()) { + for (HashDb db : this.hashSets) { if (dbInfo.matches(db)) { return false; }