From 97a244fc86df1a214531f16dcc9e05caa016d590 Mon Sep 17 00:00:00 2001 From: momo Date: Fri, 11 Sep 2015 15:16:31 -0400 Subject: [PATCH 1/3] adding null check for jobTotals in case jobId was not found --- .../autopsy/modules/hashdatabase/HashDbIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java index 1632d02279..d4fd424901 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java @@ -338,7 +338,7 @@ public class HashDbIngestModule implements FileIngestModule { List knownBadHashSets, List knownHashSets) { IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); - if ((!knownBadHashSets.isEmpty()) || (!knownHashSets.isEmpty())) { + if (jobTotals != null && ((!knownBadHashSets.isEmpty()) || (!knownHashSets.isEmpty()))) { StringBuilder detailsSb = new StringBuilder(); //details detailsSb.append(""); //NON-NLS From 9d5470d93aa5987e58592d3afdb6296e9eab55b1 Mon Sep 17 00:00:00 2001 From: momo Date: Fri, 11 Sep 2015 16:06:16 -0400 Subject: [PATCH 2/3] create a new jobs total for each job --- .../autopsy/modules/hashdatabase/HashDbIngestModule.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java index d4fd424901..0a736ddeda 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java @@ -87,8 +87,10 @@ public class HashDbIngestModule implements FileIngestModule { updateEnabledHashSets(hashDbManager.getKnownFileHashSets(), knownHashSets); if (refCounter.incrementAndGet(jobId) == 1) { - // if first module for this job then post error msgs if needed + // safely create a jobs total for this job + getTotalsForIngestJobs(jobId); + // if first module for this job then post error msgs if needed if (knownBadHashSets.isEmpty()) { services.postMessage(IngestMessage.createWarningMessage( HashLookupModuleFactory.getModuleName(), @@ -336,9 +338,10 @@ public class HashDbIngestModule implements FileIngestModule { private static synchronized void postSummary(long jobId, List knownBadHashSets, List knownHashSets) { - IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); + IngestJobTotals jobTotals = getTotalsForIngestJobs(jobId); + totalsForIngestJobs.remove(jobId); - if (jobTotals != null && ((!knownBadHashSets.isEmpty()) || (!knownHashSets.isEmpty()))) { + if ((!knownBadHashSets.isEmpty()) || (!knownHashSets.isEmpty())) { StringBuilder detailsSb = new StringBuilder(); //details detailsSb.append("
"); //NON-NLS From e3da44aacf0005d45367025928a9604cd5964275 Mon Sep 17 00:00:00 2001 From: momo Date: Fri, 11 Sep 2015 16:07:17 -0400 Subject: [PATCH 3/3] remove redundant code --- .../autopsy/modules/hashdatabase/HashDbIngestModule.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java index 0a736ddeda..a6b440de33 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java @@ -87,10 +87,8 @@ public class HashDbIngestModule implements FileIngestModule { updateEnabledHashSets(hashDbManager.getKnownFileHashSets(), knownHashSets); if (refCounter.incrementAndGet(jobId) == 1) { - // safely create a jobs total for this job - getTotalsForIngestJobs(jobId); - - // if first module for this job then post error msgs if needed + // if first module for this job then post error msgs if needed + if (knownBadHashSets.isEmpty()) { services.postMessage(IngestMessage.createWarningMessage( HashLookupModuleFactory.getModuleName(),