From ea55a7a879cbcdd40d1c5e566e2e6395028951ad Mon Sep 17 00:00:00 2001 From: Sophie Mori Date: Mon, 19 Sep 2016 11:39:34 -0400 Subject: [PATCH 1/2] Changed requested code --- .../keywordsearch/KeywordSearchIngestModule.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java index 13f69b6998..908a57ed6e 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java @@ -111,6 +111,13 @@ public final class KeywordSearchIngestModule implements FileIngestModule { }; private static final Map> ingestStatus = new HashMap<>(); //guarded by itself + /** + * Records the ingest status for a given file for a given ingest job. Used + * for final statistics at the end of the job. + * @param ingestJobId id of ingest job + * @param fileId id of file + * @param status ingest status of the file + */ private static void putIngestStatus(long ingestJobId, long fileId, IngestStatus status) { synchronized (ingestStatus) { Map ingestStatusForJob = ingestStatus.get(ingestJobId); @@ -118,7 +125,6 @@ public final class KeywordSearchIngestModule implements FileIngestModule { ingestStatusForJob = new HashMap<>(); ingestStatus.put(ingestJobId, ingestStatusForJob); } - ingestStatusForJob.put(fileId, status); ingestStatus.put(ingestJobId, ingestStatusForJob); } @@ -551,8 +557,11 @@ public final class KeywordSearchIngestModule implements FileIngestModule { return; } if (!extractTextAndIndex(aFile, fileType)) { - logger.log(Level.WARNING, "Failed to extract text and ingest, file ''{0}'' (id: {1}).", new Object[]{aFile.getName(), aFile.getId()}); //NON-NLS + logger.log(Level.WARNING, "Text extractor not found for file. Extracting strings only. File: ''{0}'' (id:{1}).", new Object[]{aFile.getName(), aFile.getId()}); //NON-NLS putIngestStatus(jobId, aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); + } else if (fileType.equals("application/octet-stream")) { + extractStringsAndIndex(aFile); + return; } else { putIngestStatus(jobId, aFile.getId(), IngestStatus.TEXT_INGESTED); wasTextAdded = true; From 25639b76e1c900e0a6f82fcf3d54c9c1287c400f Mon Sep 17 00:00:00 2001 From: Sophie Mori Date: Wed, 28 Sep 2016 15:38:18 -0400 Subject: [PATCH 2/2] Fixed if else logic --- .../autopsy/keywordsearch/KeywordSearchIngestModule.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java index 908a57ed6e..c0ced07107 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java @@ -556,12 +556,13 @@ public final class KeywordSearchIngestModule implements FileIngestModule { if (context.fileIngestIsCancelled()) { return; } + if (fileType.equals("application/octet-stream")) { + extractStringsAndIndex(aFile); + return; + } if (!extractTextAndIndex(aFile, fileType)) { logger.log(Level.WARNING, "Text extractor not found for file. Extracting strings only. File: ''{0}'' (id:{1}).", new Object[]{aFile.getName(), aFile.getId()}); //NON-NLS putIngestStatus(jobId, aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); - } else if (fileType.equals("application/octet-stream")) { - extractStringsAndIndex(aFile); - return; } else { putIngestStatus(jobId, aFile.getId(), IngestStatus.TEXT_INGESTED); wasTextAdded = true;