From e7edee680170ddecdc53ece99274cf06bb31cb47 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Tue, 28 Apr 2020 09:38:01 -0400 Subject: [PATCH] Update ExtractSru.java More codacy --- .../autopsy/recentactivity/ExtractSru.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractSru.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractSru.java index a4d33bb05d..c1f75f121b 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractSru.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractSru.java @@ -101,16 +101,13 @@ final class ExtractSru extends Extract { this.context = context; - FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); - String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + "sru"; //NON-NLS - + String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + "sru"; File dir = new File(modOutPath); if (dir.exists() == false) { dir.mkdirs(); } String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "sru"); //NON-NLS -// String softwareHiveFileName = null; String softwareHiveFileName = getSoftwareHiveFile(dataSource, tempDirPath); if (softwareHiveFileName == null) { @@ -119,6 +116,7 @@ final class ExtractSru extends Extract { List sruFiles; + FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); try { sruFiles = fileManager.findFiles(dataSource, "SRUDB.DAT"); //NON-NLS } catch (TskCoreException ex) { @@ -128,17 +126,13 @@ final class ExtractSru extends Extract { } String sruFileName = null; - String tempOutFile = null; AbstractFile sruAbstractFile = null; - + String modOutFile = null; + for (AbstractFile sruFile : sruFiles) { - if (context.dataSourceIngestIsCancelled()) { - return; - } - sruFileName = tempDirPath + File.separator + sruFile.getId() + "_" + sruFile.getName(); - tempOutFile = modOutPath + File.separator + sruFile.getId() + "_srudb.db3"; + modOutFile = modOutPath + File.separator + sruFile.getId() + "_srudb.db3"; sruAbstractFile = sruFile; try { @@ -168,10 +162,10 @@ final class ExtractSru extends Extract { } try { - extractSruFiles(sruDumper, sruFileName, tempOutFile, tempDirPath, softwareHiveFileName); - findSruExecutedFiles(tempOutFile, dataSource); - createNetUsageArtifacts(tempOutFile, sruAbstractFile); - createAppUsageArtifacts(tempOutFile, sruAbstractFile); + extractSruFiles(sruDumper, sruFileName, modOutFile, tempDirPath, softwareHiveFileName); + findSruExecutedFiles(modOutFile, dataSource); + createNetUsageArtifacts(modOutFile, sruAbstractFile); + createAppUsageArtifacts(modOutFile, sruAbstractFile); } catch (IOException ex) { this.addErrorMessage(Bundle.ExtractSru_process_error_executing_export_srudb_program()); logger.log(Level.SEVERE, "SRUDB.dat file not found"); //NON-NLS @@ -208,10 +202,6 @@ final class ExtractSru extends Extract { for (AbstractFile softwareFile : softwareHiveFiles) { - if (context.dataSourceIngestIsCancelled()) { - return null; - } - if (softwareFile.getParentPath().endsWith("/config/")) { softwareHiveFileName = tempDirPath + File.separator + softwareFile.getId() + "_" + softwareFile.getName();