From eb19619daee1abe182ada005c31a28943e3019c7 Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Mon, 12 Mar 2018 10:17:52 -0600 Subject: [PATCH] removed use of deprecated functions --- .../autopsy/commonfilesearch/CommonFilesPanel.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 11fb49406d..d075cbcfce 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -23,9 +23,11 @@ import java.awt.event.ActionListener; import java.util.Collections; import java.util.List; import java.util.logging.Level; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.windows.TopComponent; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.autopsy.coreutils.Logger; @@ -67,15 +69,15 @@ public final class CommonFilesPanel extends javax.swing.JPanel { String title = NbBundle.getMessage(this.getClass(), "CommonFilesPanel.search.results.title"); String pathText = NbBundle.getMessage(this.getClass(), "CommonFilesPanel.search.results.pathText"); - //TODO somehow thats not deprecated??? - Case currentCase = Case.getCurrentCase(); - List contentList = null; try { + Case currentCase = Case.getOpenCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); - //tskDb.executeQuery("SELECT *, COUNT(*) FROM tsk_files GROUP BY md5 HAVING COUNT(*) > 1;"); + + //TODO this is sort of a misues of the findAllFilesWhere function and seems brittle... + //...consider doing something else contentList = tskDb.findAllFilesWhere("1 == 1 GROUP BY md5 HAVING COUNT(*) > 1;"); - } catch (TskCoreException ex) { + } catch (TskCoreException | NoCurrentCaseException ex) { Logger logger = Logger.getLogger(this.getClass().getName()); logger.log(Level.WARNING, "Error while trying to get common files.", ex); }