From 25f954c4d361f00bfaf13ed1f1fae9a67380d71e Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Tue, 3 May 2016 12:01:17 -0400 Subject: [PATCH] Updated cancellation policy. --- .../autopsy/report/ReportGenerator.java | 58 +++++++------------ .../sleuthkit/autopsy/report/ReportKML.java | 7 --- 2 files changed, 22 insertions(+), 43 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java index 7e4896b531..6228a5b96d 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java @@ -318,7 +318,7 @@ class ReportGenerator { List files = getFiles(); int numFiles = files.size(); - if (fileReportModule != null) { + if (progressPanel.getStatus() != ReportStatus.CANCELED) { fileReportModule.startReport(reportPath); fileReportModule.startTable(enabledInfo); } @@ -329,12 +329,8 @@ class ReportGenerator { // Add files to report. for (AbstractFile file : files) { // Check to see if any reports have been cancelled. - if (fileReportModule == null) { - break; - } - // Remove cancelled reports, add files to report otherwise. if (progressPanel.getStatus() == ReportStatus.CANCELED) { - fileReportModule = null; + return 0; } else { fileReportModule.addRow(file, enabledInfo); progressPanel.increment(); @@ -428,22 +424,28 @@ class ReportGenerator { @Override protected Integer doInBackground() throws Exception { // Start the progress indicators for each active TableReportModule. - if (progressPanel.getStatus() == ReportStatus.CANCELED) { - } else { - tableReportModule.startReport(reportPath); - progressPanel.start(); - progressPanel.setIndeterminate(false); - progressPanel.setMaximumProgress(this.artifactTypes.size() + 2); // +2 for content and blackboard artifact tags - } + tableReportModule.startReport(reportPath); + progressPanel.start(); + progressPanel.setIndeterminate(false); + progressPanel.setMaximumProgress(this.artifactTypes.size() + 2); // +2 for content and blackboard artifact tags // report on the blackboard results - makeBlackboardArtifactTables(); + if (progressPanel.getStatus() != ReportStatus.CANCELED) { + makeBlackboardArtifactTables(); + } // report on the tagged files and artifacts - makeContentTagsTables(); - makeBlackboardArtifactTagsTables(); + if (progressPanel.getStatus() != ReportStatus.CANCELED) { + makeContentTagsTables(); + } - // report on the tagged images - makeThumbnailTable(); + if (progressPanel.getStatus() != ReportStatus.CANCELED) { + makeBlackboardArtifactTagsTables(); + } + + if (progressPanel.getStatus() != ReportStatus.CANCELED) { + // report on the tagged images + makeThumbnailTable(); + } // finish progress, wrap up progressPanel.complete(ReportStatus.COMPLETE); @@ -466,8 +468,8 @@ class ReportGenerator { // Add a table to the report for every enabled blackboard artifact type. for (BlackboardArtifact.Type type : artifactTypes) { // Check for cancellaton. - removeCancelledTableReportModules(); - if (tableReportModule == null) { + + if (progressPanel.getStatus() == ReportStatus.CANCELED) { return; } @@ -543,11 +545,6 @@ class ReportGenerator { */ @SuppressWarnings("deprecation") private void makeContentTagsTables() { - // Check for cancellaton. - removeCancelledTableReportModules(); - if (tableReportModule == null) { - return; - } // Get the content tags. List tags; @@ -660,11 +657,6 @@ class ReportGenerator { */ @SuppressWarnings("deprecation") private void makeBlackboardArtifactTagsTables() { - // Check for cancellaton. - removeCancelledTableReportModules(); - if (tableReportModule == null) { - return; - } List tags; try { @@ -724,12 +716,6 @@ class ReportGenerator { return tagNamesFilter.isEmpty() || tagNamesFilter.contains(tagName); } - void removeCancelledTableReportModules() { - if (progressPanel.getStatus() == ReportStatus.CANCELED) { - tableReportModule = null; - } - } - /** * Make a report for the files that were previously found to be images. */ diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java index d8bb02508a..f1542566fe 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java @@ -82,10 +82,6 @@ class ReportKML implements GeneralReportModule { String reportPath2 = baseReportDir + "ReportKML.txt"; //NON-NLS currentCase = Case.getCurrentCase(); skCase = currentCase.getSleuthkitCase(); - - if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) { - return; - } progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading")); // Check if ingest has finished String ingestwarning = ""; @@ -99,9 +95,6 @@ class ReportKML implements GeneralReportModule { // Why not just print the coordinates as we find them and make some utility methods to do the printing? // Should pull out time values for all of these points and store in TimeSpan element try { - if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) { - return; - } try (BufferedWriter out = new BufferedWriter(new FileWriter(reportPath2))) { double lat = 0; // temp latitude