From dcdc16e57f16bc82b8a61b882e7f353871778f4e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 29 Jul 2019 17:21:49 -0400 Subject: [PATCH 1/6] 5118 eliminate sout calls which are not required --- .../autopsy/coreutils/Bundle.properties | 6 +-- .../autopsy/coreutils/PlatformUtil.java | 48 +++++++++---------- .../autopsy/ingest/RunIngestSubMenu.java | 6 ++- .../autopsy/modules/iOS/ContactAnalyzer.java | 5 +- .../modules/stix/StixArtifactData.java | 12 ++--- .../InterCaseTestUtils.java | 2 - .../translators/BingTranslatorTest.java | 3 +- .../translators/GoogleTranslatorTest.java | 7 ++- .../CreditCardValidatorTest.java | 17 ------- .../autopsy/scalpel/jni/ScalpelCarver.java | 2 - 10 files changed, 40 insertions(+), 68 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties index d8d9188b3d..6589510eb7 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties @@ -8,11 +8,11 @@ PlatformUtil.jrePath.usingJavaPath.msg=Using java binary path: {0} PlatformUtil.getPID.sigarNotInit.msg=Cannot get PID, sigar not initialized PlatformUtil.getPID.gen.msg=Cannot get PID,{0} PlatformUtil.getJavaPID.sigarNotInit.msg=Cannot get PID of a java process, sigar not initialized -PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0}, {1} +PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0} PlatformUtil.getJavaPIDs.sigarNotInit=Cannot get PIDs of a java process, sigar not initialized -PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0}, {1} +PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0} PlatformUtil.killProcess.sigarNotInit.msg=Cannot kill process by pid, sigar not initialized. -PlatformUtil.killProcess.gen.msg=Cannot kill process: {0}, {1} +PlatformUtil.killProcess.gen.msg=Cannot kill process: {0} PlatformUtil.getProcVmUsed.sigarNotInit.msg=Cannot get virt mem used, sigar not initialized. PlatformUtil.getProcVmUsed.gen.msg=Cannot get virt mem used, {0} PlatformUtil.getJvmMemInfo.usageText=JVM heap usage: {0}, JVM non-heap usage: {1} diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java index 88e33c7407..e97b6824e7 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java @@ -35,6 +35,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.logging.Level; import javax.swing.filechooser.FileSystemView; import org.apache.commons.io.FilenameUtils; import org.hyperic.sigar.Sigar; @@ -55,6 +56,7 @@ public class PlatformUtil { private static final String CLASSIFIERS_SUBDIRECTORY = "object_detection_classifiers"; //NON-NLS private static final String OCR_LANGUAGE_SUBDIRECTORY = "ocr_language_packs"; //NON-NLS private static final String OCR_LANGUAGE_PACK_EXT = "traineddata"; + private static final Logger logger = Logger.getLogger(PlatformUtil.class.getName()); private static String javaPath = null; public static final String OS_NAME_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.nameUnknown"); public static final String OS_VERSION_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.verUnknown"); @@ -119,19 +121,19 @@ public class PlatformUtil { public static String getUserPythonModulesPath() { return getUserDirectory().getAbsolutePath() + File.separator + PYTHON_MODULES_SUBDIRECTORY; } - + /** * Get root path where the user's Ocr language packs are stored. - * + * * @return Absolute path to the Ocr language packs root directory. */ public static String getOcrLanguagePacksPath() { return getUserDirectory().getAbsolutePath() + File.separator + OCR_LANGUAGE_SUBDIRECTORY; } - + /** * Get the names of the language packs installed at the user directory. - * + * * @return List of language packs base names */ public static List getOcrLanguagePacks() { @@ -139,20 +141,20 @@ public class PlatformUtil { List languagePacks = new ArrayList<>(); for (File languagePack : languagePackRootDir.listFiles()) { - String fileExt = FilenameUtils.getExtension(languagePack.getName()); + String fileExt = FilenameUtils.getExtension(languagePack.getName()); if (!languagePack.isDirectory() && OCR_LANGUAGE_PACK_EXT.equals(fileExt)) { String packageName = FilenameUtils.getBaseName(languagePack.getName()); languagePacks.add(packageName); } } - + return languagePacks; } /** * Get root path where the user's object detection classifiers are stored. - * - * @return Absolute path to the object detection classifiers root directory. + * + * @return Absolute path to the object detection classifiers root directory. */ public static String getObjectDetectionClassifierPath() { return getUserDirectory().getAbsolutePath() + File.separator + CLASSIFIERS_SUBDIRECTORY; @@ -172,10 +174,7 @@ public class PlatformUtil { File jrePath = new File(getInstallPath() + File.separator + "jre"); if (jrePath.exists() && jrePath.isDirectory()) { - System.out.println( - NbBundle.getMessage(PlatformUtil.class, - "PlatformUtil.jrePath.jreDir.msg", - jrePath.getAbsolutePath())); + logger.log(Level.INFO, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.jreDir.msg", jrePath.getAbsolutePath())); javaPath = jrePath.getAbsolutePath() + File.separator + "bin" + File.separator + "java"; //NON-NLS } else { //else use system installed java in PATH env variable @@ -183,7 +182,7 @@ public class PlatformUtil { } - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.usingJavaPath.msg", javaPath)); + logger.log(Level.INFO, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.usingJavaPath.msg", javaPath)); return javaPath; } @@ -504,10 +503,10 @@ public class PlatformUtil { if (sigar != null) { pid = sigar.getPid(); } else { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.sigarNotInit.msg")); + logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.sigarNotInit.msg")); } } catch (Exception e) { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.gen.msg", e.toString())); + logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.gen.msg"), e); } return pid; @@ -534,11 +533,10 @@ public class PlatformUtil { ProcessFinder finder = new ProcessFinder(sigar); jpid = finder.findSingleProcess(sigarQuery); } else { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.sigarNotInit.msg")); + logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.sigarNotInit.msg")); } } catch (Exception e) { - System.out.println( - NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.gen.msg", sigarQuery, e.toString())); + logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.gen.msg", sigarQuery), e); } return jpid; @@ -566,11 +564,10 @@ public class PlatformUtil { ProcessFinder finder = new ProcessFinder(sigar); jpids = finder.find(sigarQuery); } else { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.sigarNotInit")); + logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.sigarNotInit")); } } catch (Exception e) { - System.out.println( - NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.gen.msg", sigarQuery, e.toString())); + logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.gen.msg", sigarQuery), e); } return jpids; @@ -589,11 +586,10 @@ public class PlatformUtil { if (sigar != null) { sigar.kill(pid, 9); } else { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.sigarNotInit.msg")); + logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.sigarNotInit.msg")); } } catch (Exception e) { - System.out.println( - NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.gen.msg", pid, e.toString())); + logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.gen.msg", pid), e); } } @@ -612,12 +608,12 @@ public class PlatformUtil { } if (sigar == null || getPID() == -1) { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.sigarNotInit.msg")); + logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.sigarNotInit.msg")); return -1; } virtMem = sigar.getProcMem(getPID()).getSize(); } catch (Exception e) { - System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.gen.msg", e.toString())); + logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.gen.msg"), e); } return virtMem; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index c03abd577b..2e27e8e71b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -22,12 +22,14 @@ import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.logging.Level; import javax.swing.JComponent; import javax.swing.JMenuItem; import org.openide.awt.DynamicMenuContent; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -37,6 +39,8 @@ import org.sleuthkit.datamodel.TskCoreException; */ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { + private static final Logger logger = Logger.getLogger(RunIngestSubMenu.class.getName()); + /** * Creates main menu/popup menu items. It's called each time a popup menu is * constructed and just once for the main menu. Main menu updates happen @@ -54,7 +58,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { // No open Cases, create a disabled empty menu return getEmpty(); } catch (TskCoreException | NoCurrentCaseException e) { - System.out.println("Exception getting images: " + e.getMessage()); //NON-NLS + logger.log(Level.WARNING, "Exception getting images.", e); } JComponent[] comps = new JComponent[dataSources.size()]; diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java index ce3f971bee..c394c7b232 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java +++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java @@ -216,7 +216,6 @@ final class ContactAnalyzer { try { while ((length = is.read(buffer)) != -1) { os.write(buffer, 0, length); - System.out.println(length); os.flush(); } @@ -239,13 +238,13 @@ final class ContactAnalyzer { ostream.write(c); } } catch (IOException e) { - System.out.println("Error: " + e.getMessage()); //NON-NLS + logger.log(Level.WARNING, "Error copying file", e); } finally { try { istream.close(); ostream.close(); } catch (IOException e) { - System.out.println("File did not close"); //NON-NLS + logger.log(Level.WARNING, "File did not close", e); } } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java index 4df69801aa..60444587de 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java +++ b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2018 Basis Technology Corp. + * Copyright 2013-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,13 +43,13 @@ class StixArtifactData { private final String objType; private static final Logger logger = Logger.getLogger(StixArtifactData.class.getName()); - public StixArtifactData(AbstractFile a_file, String a_observableId, String a_objType) { + StixArtifactData(AbstractFile a_file, String a_observableId, String a_objType) { file = a_file; observableId = a_observableId; objType = a_objType; } - public StixArtifactData(long a_objId, String a_observableId, String a_objType) { + StixArtifactData(long a_objId, String a_observableId, String a_objType) { try { Case case1 = Case.getCurrentCaseThrows(); SleuthkitCase sleuthkitCase = case1.getSleuthkitCase(); @@ -63,7 +63,7 @@ class StixArtifactData { @Messages({"StixArtifactData.indexError.message=Failed to index STIX interesting file hit artifact for keyword search.", "StixArtifactData.noOpenCase.errMsg=No open case available."}) - public void createArtifact(String a_title) throws TskCoreException { + void createArtifact(String a_title) throws TskCoreException { Case currentCase; try { currentCase = Case.getCurrentCaseThrows(); @@ -101,8 +101,4 @@ class StixArtifactData { } } } - - public void print() { - System.out.println(" " + observableId + " " + file.getName()); - } } diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java index 85d5ad3593..6920dfa64f 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java @@ -279,10 +279,8 @@ class InterCaseTestUtils { for (CorrelationCase correlationCase : EamDb.getInstance().getCases()) { mapOfCaseIdsToCase.put(correlationCase.getDisplayName(), correlationCase.getID()); } - System.out.println("EAM IS ENABLED"); return mapOfCaseIdsToCase; } else { - System.out.println("EAMDB NOT ENABLED"); //it is reasonable that this might happen... // for example when we test the feature in the absence of an enabled eamdb return new HashMap<>(0); diff --git a/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorTest.java b/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorTest.java index 25c78ba049..320878e4bd 100644 --- a/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorTest.java +++ b/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorTest.java @@ -85,8 +85,7 @@ public class BingTranslatorTest { // /* // //It's unrealistic to expect the same answer every time, but sometimes // //it's helpful to have this in your debug process. -// System.out.println(translation); -// assertEquals(expectedTranslation, translation); +// assertEquals("Result did not match expected result", expectedTranslation, translation); // */ // } } diff --git a/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorTest.java b/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorTest.java index 014c8cc72a..087869e797 100644 --- a/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorTest.java +++ b/Core/test/unit/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorTest.java @@ -37,8 +37,8 @@ public class GoogleTranslatorTest { // //It's unrealistic to expect the same answer every time, but sometimes // //it's helpful to have this in your debug process. // -// String expResult = "translate"; assertEquals(expResult, result); -// System.out.println(result); +// String expResult = "translate"; assertEquals(expResult, result); +// assertEquals("Result did not match expected result" expResult, result); } //Commented out because using TranslateOption with the current version of Guava is not supported JIRA-5063 @@ -63,7 +63,6 @@ public class GoogleTranslatorTest { // //It's unrealistic to expect the same answer every time, but sometimes // //it's helpful to have this in your debug process. // String expResult = "¡Hola Mundo!"; -// assertEquals(expResult, result); -// System.out.println(result); +// assertEquals("Result did not match expected result", expResult, result); // } } diff --git a/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java b/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java index e59b2b98f3..40978c6cf9 100644 --- a/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java +++ b/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java @@ -48,8 +48,6 @@ public class CreditCardValidatorTest { @Test public void testLengthMatchesBin() { - System.out.println("lengthMatchesBin"); - //amex must be 15 assertEquals(true, CreditCardValidator.isValidCCN("3431 136294 58529")); assertEquals(false, CreditCardValidator.isValidCCN("3431-136294-5850")); //too short @@ -95,8 +93,6 @@ public class CreditCardValidatorTest { */ @Test public void testIsValidCCN16() { - System.out.println("isValidCCN"); - //rules for separators and grouping for 16 digits assertEquals(true, CreditCardValidator.isValidCCN("1234567890318342"));// dashes assertEquals(true, CreditCardValidator.isValidCCN("1234-5678-9031-8342"));// dashes @@ -111,8 +107,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN15() { - System.out.println("isValidCCN"); - //amex are fifteen digits, and grouped 4 6 5 //amex cards that strart with 34 assertEquals(true, CreditCardValidator.isValidCCN("3431 136294 58529")); @@ -143,7 +137,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN19() { - System.out.println("isValidCCN"); //nineteen digit (visa) cards 4-4-4-4-3 assertEquals(true, CreditCardValidator.isValidCCN("4539747947839518654")); assertEquals(true, CreditCardValidator.isValidCCN("4539-7479-4783-9518-654")); @@ -168,8 +161,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN18() { - System.out.println("isValidCCN"); - assertEquals(true, CreditCardValidator.isValidCCN("123456789031834267")); assertEquals(true, CreditCardValidator.isValidCCN("1234 5678 9031 8342 67")); assertEquals(true, CreditCardValidator.isValidCCN("1234-56789031834-267")); @@ -181,8 +172,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN17() { - System.out.println("isValidCCN"); - assertEquals(true, CreditCardValidator.isValidCCN("12345678903183426")); assertEquals(true, CreditCardValidator.isValidCCN("1234 5678 9031 8342 6")); assertEquals(true, CreditCardValidator.isValidCCN("1234-56789031834-26")); @@ -194,8 +183,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN14() { - System.out.println("isValidCCN"); - assertEquals(true, CreditCardValidator.isValidCCN("12345678903183")); assertEquals(true, CreditCardValidator.isValidCCN("1234 5678 9031 83")); assertEquals(true, CreditCardValidator.isValidCCN("1234-5678903183")); @@ -207,8 +194,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN13() { - System.out.println("isValidCCN"); - assertEquals(true, CreditCardValidator.isValidCCN("1234567890318")); assertEquals(true, CreditCardValidator.isValidCCN("1234 5678 9031 8")); assertEquals(true, CreditCardValidator.isValidCCN("1234-567890318")); @@ -220,8 +205,6 @@ public class CreditCardValidatorTest { @Test public void testIsValidCCN12() { - System.out.println("isValidCCN"); - assertEquals(true, CreditCardValidator.isValidCCN("123456789031")); assertEquals(true, CreditCardValidator.isValidCCN("1234 5678 9031")); assertEquals(true, CreditCardValidator.isValidCCN("1234-56789031")); diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java index e93803dd0c..acb014e34a 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java @@ -79,11 +79,9 @@ public class ScalpelCarver { success = true; } catch (UnsatisfiedLinkError ex) { String msg = NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.loadLib.errMsg.cannotLoadLib", id); - System.out.println(msg + ex.toString()); logger.log(Level.SEVERE, msg, ex); } catch (Exception ex) { String msg = NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.loadLib.errMsg.cannotLoadLib2", id); - System.out.println(msg + ex.toString()); logger.log(Level.SEVERE, msg, ex); } From bb212e8b9f7f10cf079a6935bc1f038a1c3fd92e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 29 Jul 2019 17:42:04 -0400 Subject: [PATCH 2/6] 5118 update bundle merged file --- .../sleuthkit/autopsy/coreutils/Bundle.properties-MERGED | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED index 17791d159d..d37f1ed29c 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED @@ -14,11 +14,11 @@ PlatformUtil.jrePath.usingJavaPath.msg=Using java binary path: {0} PlatformUtil.getPID.sigarNotInit.msg=Cannot get PID, sigar not initialized PlatformUtil.getPID.gen.msg=Cannot get PID,{0} PlatformUtil.getJavaPID.sigarNotInit.msg=Cannot get PID of a java process, sigar not initialized -PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0}, {1} +PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0} PlatformUtil.getJavaPIDs.sigarNotInit=Cannot get PIDs of a java process, sigar not initialized -PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0}, {1} +PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0} PlatformUtil.killProcess.sigarNotInit.msg=Cannot kill process by pid, sigar not initialized. -PlatformUtil.killProcess.gen.msg=Cannot kill process: {0}, {1} +PlatformUtil.killProcess.gen.msg=Cannot kill process: {0} PlatformUtil.getProcVmUsed.sigarNotInit.msg=Cannot get virt mem used, sigar not initialized. PlatformUtil.getProcVmUsed.gen.msg=Cannot get virt mem used, {0} PlatformUtil.getJvmMemInfo.usageText=JVM heap usage: {0}, JVM non-heap usage: {1} From 1cca4bf20ad5591547f425f9c54736ac607d9862 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 30 Jul 2019 10:10:23 -0400 Subject: [PATCH 3/6] 5118 undo changes to class used by logger --- .../autopsy/coreutils/Bundle.properties | 6 ++-- .../coreutils/Bundle.properties-MERGED | 6 ++-- .../autopsy/coreutils/PlatformUtil.java | 32 +++++++++++-------- .../autopsy/ingest/RunIngestSubMenu.java | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties index 6589510eb7..d8d9188b3d 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties @@ -8,11 +8,11 @@ PlatformUtil.jrePath.usingJavaPath.msg=Using java binary path: {0} PlatformUtil.getPID.sigarNotInit.msg=Cannot get PID, sigar not initialized PlatformUtil.getPID.gen.msg=Cannot get PID,{0} PlatformUtil.getJavaPID.sigarNotInit.msg=Cannot get PID of a java process, sigar not initialized -PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0} +PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0}, {1} PlatformUtil.getJavaPIDs.sigarNotInit=Cannot get PIDs of a java process, sigar not initialized -PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0} +PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0}, {1} PlatformUtil.killProcess.sigarNotInit.msg=Cannot kill process by pid, sigar not initialized. -PlatformUtil.killProcess.gen.msg=Cannot kill process: {0} +PlatformUtil.killProcess.gen.msg=Cannot kill process: {0}, {1} PlatformUtil.getProcVmUsed.sigarNotInit.msg=Cannot get virt mem used, sigar not initialized. PlatformUtil.getProcVmUsed.gen.msg=Cannot get virt mem used, {0} PlatformUtil.getJvmMemInfo.usageText=JVM heap usage: {0}, JVM non-heap usage: {1} diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED index d37f1ed29c..17791d159d 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/coreutils/Bundle.properties-MERGED @@ -14,11 +14,11 @@ PlatformUtil.jrePath.usingJavaPath.msg=Using java binary path: {0} PlatformUtil.getPID.sigarNotInit.msg=Cannot get PID, sigar not initialized PlatformUtil.getPID.gen.msg=Cannot get PID,{0} PlatformUtil.getJavaPID.sigarNotInit.msg=Cannot get PID of a java process, sigar not initialized -PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0} +PlatformUtil.getJavaPID.gen.msg=Cannot get PID for query: {0}, {1} PlatformUtil.getJavaPIDs.sigarNotInit=Cannot get PIDs of a java process, sigar not initialized -PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0} +PlatformUtil.getJavaPIDs.gen.msg=Cannot get PIDs for query: {0}, {1} PlatformUtil.killProcess.sigarNotInit.msg=Cannot kill process by pid, sigar not initialized. -PlatformUtil.killProcess.gen.msg=Cannot kill process: {0} +PlatformUtil.killProcess.gen.msg=Cannot kill process: {0}, {1} PlatformUtil.getProcVmUsed.sigarNotInit.msg=Cannot get virt mem used, sigar not initialized. PlatformUtil.getProcVmUsed.gen.msg=Cannot get virt mem used, {0} PlatformUtil.getJvmMemInfo.usageText=JVM heap usage: {0}, JVM non-heap usage: {1} diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java index e97b6824e7..77d2bf2a95 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java @@ -35,7 +35,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.logging.Level; import javax.swing.filechooser.FileSystemView; import org.apache.commons.io.FilenameUtils; import org.hyperic.sigar.Sigar; @@ -56,7 +55,6 @@ public class PlatformUtil { private static final String CLASSIFIERS_SUBDIRECTORY = "object_detection_classifiers"; //NON-NLS private static final String OCR_LANGUAGE_SUBDIRECTORY = "ocr_language_packs"; //NON-NLS private static final String OCR_LANGUAGE_PACK_EXT = "traineddata"; - private static final Logger logger = Logger.getLogger(PlatformUtil.class.getName()); private static String javaPath = null; public static final String OS_NAME_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.nameUnknown"); public static final String OS_VERSION_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.verUnknown"); @@ -174,7 +172,10 @@ public class PlatformUtil { File jrePath = new File(getInstallPath() + File.separator + "jre"); if (jrePath.exists() && jrePath.isDirectory()) { - logger.log(Level.INFO, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.jreDir.msg", jrePath.getAbsolutePath())); + System.out.println( + NbBundle.getMessage(PlatformUtil.class, + "PlatformUtil.jrePath.jreDir.msg", + jrePath.getAbsolutePath())); javaPath = jrePath.getAbsolutePath() + File.separator + "bin" + File.separator + "java"; //NON-NLS } else { //else use system installed java in PATH env variable @@ -182,7 +183,7 @@ public class PlatformUtil { } - logger.log(Level.INFO, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.usingJavaPath.msg", javaPath)); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.jrePath.usingJavaPath.msg", javaPath)); return javaPath; } @@ -503,10 +504,10 @@ public class PlatformUtil { if (sigar != null) { pid = sigar.getPid(); } else { - logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.sigarNotInit.msg")); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.sigarNotInit.msg")); } } catch (Exception e) { - logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.gen.msg"), e); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getPID.gen.msg", e.toString())); } return pid; @@ -533,10 +534,11 @@ public class PlatformUtil { ProcessFinder finder = new ProcessFinder(sigar); jpid = finder.findSingleProcess(sigarQuery); } else { - logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.sigarNotInit.msg")); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.sigarNotInit.msg")); } } catch (Exception e) { - logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.gen.msg", sigarQuery), e); + System.out.println( + NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPID.gen.msg", sigarQuery, e.toString())); } return jpid; @@ -564,10 +566,11 @@ public class PlatformUtil { ProcessFinder finder = new ProcessFinder(sigar); jpids = finder.find(sigarQuery); } else { - logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.sigarNotInit")); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.sigarNotInit")); } } catch (Exception e) { - logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.gen.msg", sigarQuery), e); + System.out.println( + NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getJavaPIDs.gen.msg", sigarQuery, e.toString())); } return jpids; @@ -586,10 +589,11 @@ public class PlatformUtil { if (sigar != null) { sigar.kill(pid, 9); } else { - logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.sigarNotInit.msg")); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.sigarNotInit.msg")); } } catch (Exception e) { - logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.gen.msg", pid), e); + System.out.println( + NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.killProcess.gen.msg", pid, e.toString())); } } @@ -608,12 +612,12 @@ public class PlatformUtil { } if (sigar == null || getPID() == -1) { - logger.log(Level.WARNING, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.sigarNotInit.msg")); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.sigarNotInit.msg")); return -1; } virtMem = sigar.getProcMem(getPID()).getSize(); } catch (Exception e) { - logger.log(Level.SEVERE, NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.gen.msg"), e); + System.out.println(NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.getProcVmUsed.gen.msg", e.toString())); } return virtMem; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index 2e27e8e71b..6601513595 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -58,7 +58,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { // No open Cases, create a disabled empty menu return getEmpty(); } catch (TskCoreException | NoCurrentCaseException e) { - logger.log(Level.WARNING, "Exception getting images.", e); + logger.log(Level.INFO, "Exception getting images: "+ e.getMessage()); } JComponent[] comps = new JComponent[dataSources.size()]; From 50e7d7e9860a52a0d9571830365dd070bba3a1cc Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 30 Jul 2019 11:33:33 -0400 Subject: [PATCH 4/6] 5118 remove uses of exception.printStacktrace --- .../autopsy/casemodule/OptionalCasePropertiesPanel.java | 2 +- .../sleuthkit/autopsy/casemodule/StartupWindowProvider.java | 1 - .../optionspanel/ManageCorrelationPropertiesDialog.java | 2 +- .../optionspanel/ManageOrganizationsDialog.java | 2 +- .../autopsy/commonpropertiessearch/InterCasePanel.java | 6 ++++-- .../autopsy/communications/relationships/MessageViewer.java | 2 +- .../autopsy/corecomponents/ThumbnailViewChildren.java | 5 ++--- Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java | 6 ++++-- .../test/InterestingArtifactCreatorIngestModule.java | 2 +- .../autopsy/textextractors/StringsTextExtractor.java | 1 - .../imagegallery/datamodel/grouping/GroupManager.java | 4 ++-- .../org/sleuthkit/autopsy/imagegallery/gui/SortChooser.java | 1 - 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java index 241054f078..4b9b69eaa3 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java @@ -573,7 +573,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { examinerTextField.getText(), tfExaminerPhoneText.getText(), tfExaminerEmailText.getText(), taNotesText.getText())); } catch (CaseActionException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error updating case details", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java index a922a6f19d..937442e998 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java @@ -62,7 +62,6 @@ public class StartupWindowProvider implements StartupWindowInterface { if (isRunningFromCommandLine()) { // Autopsy is running from command line logger.log(Level.INFO, "Running from command line"); //NON-NLS - System.out.println("Running from command line"); startupWindowToUse = new CommandLineStartupWindow(); // kick off command line processing new CommandLineIngestManager().start(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java index 883efff72b..b8501a87db 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java @@ -74,7 +74,7 @@ final class ManageCorrelationPropertiesDialog extends javax.swing.JDialog { correlationTypes.clear(); correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); } catch (EamDbException ex) { - Exceptions.printStackTrace(ex); + LOGGER.log(Level.WARNING, "Error loading data", ex); } correlationTypes.forEach((aType) -> { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java index b36b3de413..bc653c3c28 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java @@ -78,7 +78,7 @@ public final class ManageOrganizationsDialog extends JDialog { setButtonsEnabled(organizationList.getSelectedValue()); newOrg = null; } catch (EamDbException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error getting Central Repo for Organizations dialog", ex); } display(); } diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java index c437bb0a3a..29b417fd8f 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java @@ -27,10 +27,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Observable; import java.util.Observer; +import java.util.logging.Level; import javax.swing.ComboBoxModel; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.coreutils.Logger; /** * UI controls for Common Files Search scenario where the user intends to find @@ -38,6 +39,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; */ public final class InterCasePanel extends javax.swing.JPanel { + private final static Logger logger = Logger.getLogger(InterCasePanel.class.getName()); private static final long serialVersionUID = 1L; private final Observable fileTypeFilterObservable; static final int NO_CASE_SELECTED = -1; @@ -121,7 +123,7 @@ public final class InterCasePanel extends javax.swing.JPanel { this.correlationTypeComboBox.addItem(type.getDisplayName()); } } catch (EamDbException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error getting correlation types", ex); } this.correlationTypeComboBox.setSelectedIndex(0); } diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java index 617992dab5..69ba6c82e0 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java @@ -397,7 +397,7 @@ public class MessageViewer extends JPanel implements RelationshipsViewer { try { rootTablePane.getExplorerManager().setSelectedNodes(new Node[0]); } catch (PropertyVetoException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error setting selected nodes", ex); } showThreadsPane(); }//GEN-LAST:event_backButtonActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ThumbnailViewChildren.java b/Core/src/org/sleuthkit/autopsy/corecomponents/ThumbnailViewChildren.java index 79c02fcc84..5ded426270 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/ThumbnailViewChildren.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ThumbnailViewChildren.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-18 Basis Technology Corp. + * Copyright 2011-19 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +47,6 @@ import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.corecomponents.ResultViewerPersistence.SortCriterion; @@ -197,7 +196,7 @@ class ThumbnailViewChildren extends Children.Keys { } } catch (IllegalAccessException | InvocationTargetException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error getting value for thumbnail children", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index a68a15078c..fd3c706219 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -24,9 +24,11 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; @@ -40,7 +42,7 @@ public final class IngestProfiles { private static final String PROFILE_DESC_KEY = "Profile_Description"; private static final String PROFILE_FILTER_KEY = "Profile_Filter"; private static final String PROFILE_FILE_EXT = ".properties"; - + private static final Logger logger = Logger.getLogger(IngestProfiles.class.getName()); /** * Gets the collection of profiles which currently exist. * @@ -143,7 +145,7 @@ public final class IngestProfiles { Files.deleteIfExists(Paths.get(PlatformUtil.getUserConfigDirectory(), selectedProfile.getName() + PROFILE_FILE_EXT)); FileUtils.deleteDirectory(IngestJobSettings.getSavedModuleSettingsFolder(selectedProfile.getName() + File.separator).toFile()); } catch (IOException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error deleting directory for profile " + selectedProfile.getName(), ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index f3232ceb86..01039dcce0 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -128,7 +128,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt logger.log(Level.SEVERE, String.format("Failed to process file (obj_id = %d)", file.getId()), ex); return ProcessResult.ERROR; } catch (Blackboard.BlackboardException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Blackboard Exception processing file with obj_id = ", ex); } return ProcessResult.OK; } diff --git a/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java b/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java index db0df6fa00..6a4e6d35a0 100644 --- a/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java +++ b/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java @@ -454,7 +454,6 @@ final class StringsTextExtractor implements TextExtractor { convertBuffRemain = bytesInConvertBuff - convertBuffOffset; } } catch (TskCoreException ex) { - //Exceptions.printStackTrace(ex); fileEOF = true; } } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java index 2852df20cf..c76eb258f1 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java @@ -658,7 +658,7 @@ public class GroupManager { updateCurrentPathGroup(pathGroupKey); } catch (TskCoreException | TskDataException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error getting drawabledb for fileId " + fileId, ex); } // Update all the groups that this file belongs to @@ -986,7 +986,7 @@ public class GroupManager { .findAny().ifPresent(obj_id -> types.add(mimeType)); } } catch (SQLException | TskCoreException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error getting group by MIME type", ex); } results.putAll(null, types); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SortChooser.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SortChooser.java index 5f14f1d8b9..701916c75f 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SortChooser.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SortChooser.java @@ -174,7 +174,6 @@ public class SortChooser> extends HBox { Image icon = (Image) item.getClass().getMethod("getIcon").invoke(item); setGraphic(new ImageView(icon)); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { -// Exceptions.printStackTrace(ex); setText(item.toString()); setGraphic(null); } From e1e468884b9f0c855f55a7b9661b13e1a5bd4ec1 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 30 Jul 2019 11:57:01 -0400 Subject: [PATCH 5/6] 5118 clean up imports and copyright dates --- .../casemodule/OptionalCasePropertiesPanel.java | 3 +-- .../autopsy/casemodule/StartupWindowProvider.java | 2 +- .../ManageCorrelationPropertiesDialog.java | 3 +-- .../optionspanel/ManageOrganizationsDialog.java | 3 +-- .../autopsy/commonpropertiessearch/InterCasePanel.java | 2 +- .../communications/relationships/MessageViewer.java | 1 - .../sleuthkit/autopsy/corecomponents/SortChooser.java | 2 +- .../org/sleuthkit/autopsy/coreutils/PlatformUtil.java | 2 +- .../org/sleuthkit/autopsy/ingest/IngestProfiles.java | 3 +-- .../org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java | 6 +++--- .../sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java | 2 +- .../test/InterestingArtifactCreatorIngestModule.java | 4 +--- .../autopsy/textextractors/StringsTextExtractor.java | 2 +- .../commonpropertiessearch/InterCaseTestUtils.java | 10 +--------- .../imagegallery/datamodel/grouping/GroupManager.java | 1 - .../autopsy/keywordsearch/CreditCardValidatorTest.java | 2 +- .../sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java | 2 +- 17 files changed, 17 insertions(+), 33 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java index 4b9b69eaa3..bfb8cef0c9 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/OptionalCasePropertiesPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.casemodule; import java.awt.Cursor; import java.util.logging.Level; import javax.swing.JComboBox; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java index 937442e998..13aae1c0de 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java index b8501a87db..e426534742 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2018 Basis Technology Corp. + * Copyright 2015-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,6 @@ import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java index bc653c3c28..04403be0f4 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2018 Basis Technology Corp. + * Copyright 2015-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,6 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java index 29b417fd8f..bdd5d1fb56 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java @@ -39,7 +39,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; */ public final class InterCasePanel extends javax.swing.JPanel { - private final static Logger logger = Logger.getLogger(InterCasePanel.class.getName()); + private final static Logger logger = Logger.getLogger(InterCasePanel.class.getName()); private static final long serialVersionUID = 1L; private final Observable fileTypeFilterObservable; static final int NO_CASE_SELECTED = -1; diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java index 69ba6c82e0..5e90d83c98 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageViewer.java @@ -47,7 +47,6 @@ import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.nodes.Node.Property; import org.openide.nodes.Node.PropertySet; -import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.communications.ModifiableProxyLookup; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/SortChooser.java b/Core/src/org/sleuthkit/autopsy/corecomponents/SortChooser.java index 8c7bda3e6e..4c1a012a35 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/SortChooser.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/SortChooser.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java index 77d2bf2a95..e729248b47 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2018 Basis Technology Corp. + * Copyright 2012-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index fd3c706219..5887636f85 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,6 @@ import java.util.List; import java.util.logging.Level; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index 6601513595..f4581e2694 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,7 +40,7 @@ import org.sleuthkit.datamodel.TskCoreException; final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { private static final Logger logger = Logger.getLogger(RunIngestSubMenu.class.getName()); - + /** * Creates main menu/popup menu items. It's called each time a popup menu is * constructed and just once for the main menu. Main menu updates happen @@ -58,7 +58,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { // No open Cases, create a disabled empty menu return getEmpty(); } catch (TskCoreException | NoCurrentCaseException e) { - logger.log(Level.INFO, "Exception getting images: "+ e.getMessage()); + logger.log(Level.INFO, "Exception getting images: " + e.getMessage()); } JComponent[] comps = new JComponent[dataSources.size()]; diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java index c394c7b232..a17b4cba51 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java +++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-2018 Basis Technology Corp. + * Copyright 2014-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index 01039dcce0..4c1983e582 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,6 @@ package org.sleuthkit.autopsy.test; import java.util.ArrayList; import java.util.Collection; import java.util.logging.Level; - -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; diff --git a/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java b/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java index 6a4e6d35a0..37b8d89db6 100644 --- a/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java +++ b/Core/src/org/sleuthkit/autopsy/textextractors/StringsTextExtractor.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java index 6920dfa64f..3aca6cf33a 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseTestUtils.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2018 Basis Technology Corp. + * Copyright 2018-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,19 +46,11 @@ import org.sleuthkit.autopsy.testutils.CaseUtils; import org.sleuthkit.autopsy.testutils.IngestUtils; import org.sleuthkit.datamodel.TskCoreException; import junit.framework.Assert; -import org.sleuthkit.autopsy.casemodule.CaseActionException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeInstance; -import org.sleuthkit.autopsy.commonpropertiessearch.CaseDBCommonAttributeInstanceNode; -import org.sleuthkit.autopsy.commonpropertiessearch.CentralRepoCommonAttributeInstance; -import org.sleuthkit.autopsy.commonpropertiessearch.CentralRepoCommonAttributeInstanceNode; -import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeCountSearchResults; import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader; -import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeValue; -import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeValueList; import org.sleuthkit.autopsy.coreutils.TimeStampUtils; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.modules.dataSourceIntegrity.DataSourceIntegrityModuleFactory; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java index c76eb258f1..59dae2af00 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java @@ -64,7 +64,6 @@ import static org.apache.commons.collections4.CollectionUtils.isNotEmpty; import static org.apache.commons.lang3.ObjectUtils.notEqual; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent; diff --git a/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java b/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java index 40978c6cf9..75aa200a3a 100644 --- a/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java +++ b/KeywordSearch/test/unit/src/org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java index acb014e34a..d7f77a9539 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); From e12420e58ddc82e02c70deec4cf2239194c65faf Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 5 Aug 2019 11:41:44 -0400 Subject: [PATCH 6/6] 5118 add object id to error message --- .../autopsy/test/InterestingArtifactCreatorIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index 4c1983e582..6bd99e9aba 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -126,7 +126,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt logger.log(Level.SEVERE, String.format("Failed to process file (obj_id = %d)", file.getId()), ex); return ProcessResult.ERROR; } catch (Blackboard.BlackboardException ex) { - logger.log(Level.WARNING, "Blackboard Exception processing file with obj_id = ", ex); + logger.log(Level.WARNING, "Blackboard Exception processing file with obj_id = " + file.getId(), ex); } return ProcessResult.OK; }