diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java index 0000847c63..13ca786c3b 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -84,9 +85,10 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { private Blackboard blackboard; private CommunicationArtifactsHelper communicationArtifactsHelper; - // A cache of custom attributes for the VcardParser unique to each ingest run. - private Map customAttributeCache; - + // A cache of custom attributes for the VcardParser unique to each ingest run, but consistent across threads. + private static ConcurrentMap customAttributeCache = new ConcurrentHashMap<>(); + private static Object customAttributeCacheLock = new Object(); + private static final int MBOX_SIZE_TO_SPLIT = 1048576000; private Case currentCase; @@ -100,7 +102,13 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { @Messages({"ThunderbirdMboxFileIngestModule.noOpenCase.errMsg=Exception while getting open case."}) public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; - this.customAttributeCache = new ConcurrentHashMap<>(); + + synchronized(customAttributeCacheLock) { + if (!customAttributeCache.isEmpty()) { + customAttributeCache.clear(); + } + } + try { currentCase = Case.getCurrentCaseThrows(); fileManager = Case.getCurrentCaseThrows().getServices().getFileManager(); @@ -917,7 +925,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { @Override public void shutDown() { - // nothing to shut down + synchronized(customAttributeCacheLock) { + if (!customAttributeCache.isEmpty()) { + customAttributeCache.clear(); + } + } } } diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/VcardParser.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/VcardParser.java index 6e3ff0082b..306843f025 100755 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/VcardParser.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/VcardParser.java @@ -40,6 +40,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentMap; import java.util.logging.Level; import org.apache.commons.lang3.StringUtils; import org.openide.util.NbBundle; @@ -102,12 +103,12 @@ final class VcardParser { * A custom attribute cache provided to every VcardParser from the * ThunderbirdMboxFileIngestModule, but unique to one ingest run. */ - private final Map customAttributeCache; + private final ConcurrentMap customAttributeCache; /** * Create a VcardParser object. */ - VcardParser(Case currentCase, IngestJobContext context, Map customAttributeCache) { + VcardParser(Case currentCase, IngestJobContext context, ConcurrentMap customAttributeCache) { this.context = context; this.currentCase = currentCase; tskCase = currentCase.getSleuthkitCase();