From 02faf93f1cb0c3e4ff9e7098acd8241e04aeaf28 Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Tue, 3 Apr 2018 07:31:09 -0700 Subject: [PATCH] TODOs and cleanup. --- .../commonfilesearch/CommonFilesMetaDataBuilder.java | 11 ++++++----- .../autopsy/commonfilesearch/CommonFilesPanel.java | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesMetaDataBuilder.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesMetaDataBuilder.java index 2f6f7a0414..53aaa1de30 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesMetaDataBuilder.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesMetaDataBuilder.java @@ -42,6 +42,7 @@ class CommonFilesMetaDataBuilder { private final Long selectedDataSourceId; private final Map dataSourceIdToNameMap; + //TODO subclass this class to specify where clause and/or additional algorithms. private final String singleDataSourceWhereClause = "md5 in (select md5 from tsk_files where data_source_obj_id=%s and (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) AND data_source_obj_id=%s order by md5"; private final String allDataSourcesWhereClause = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5"; @@ -68,7 +69,7 @@ class CommonFilesMetaDataBuilder { Map> md5ToDataSourcesStringMap = new HashMap<>(); try { - List files = FindCommonFiles(); + List files = findCommonFiles(); Map> parentNodes = new HashMap<>(); @@ -90,9 +91,9 @@ class CommonFilesMetaDataBuilder { if (parentNodes.containsKey(currentMd5)) { parentNodes.get(currentMd5).add(file); - Set currenDataSources = md5ToDataSourcesStringMap.get(currentMd5); - addDataSource(currenDataSources, file, dataSourceIdToNameMap); - md5ToDataSourcesStringMap.put(currentMd5, currenDataSources); + Set currentDataSources = md5ToDataSourcesStringMap.get(currentMd5); + addDataSource(currentDataSources, file, dataSourceIdToNameMap); + md5ToDataSourcesStringMap.put(currentMd5, currentDataSources); } else { List children = new ArrayList<>(); @@ -106,7 +107,7 @@ class CommonFilesMetaDataBuilder { } } - private List FindCommonFiles() throws TskCoreException, NoCurrentCaseException { + private List findCommonFiles() throws TskCoreException, NoCurrentCaseException { SleuthkitCase sleuthkitCase; sleuthkitCase = Case.getOpenCase().getSleuthkitCase(); String whereClause = allDataSourcesWhereClause; diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 6044e329c2..b871779154 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -103,6 +103,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel { return dataSourceMap.size() >= 2; } + //Make this a SwingWorker private void buildDataSourceMap(Map dataSourceMap) throws TskCoreException, NoCurrentCaseException, SQLException { Case currentCase = Case.getOpenCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase();