diff --git a/Core/src/org/sleuthkit/autopsy/report/FileReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/FileReportSettings.java index c106da5a91..e70ef7608f 100755 --- a/Core/src/org/sleuthkit/autopsy/report/FileReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/FileReportSettings.java @@ -26,21 +26,26 @@ import java.util.Map; * Class for persisting the file properties used by FileReportGenerator to drive * report generation by FileReportModules. */ -class FileReportSettings implements Serializable { - +final class FileReportSettings implements Serializable { + private static final long serialVersionUID = 1L; private Map filePropertiesInfo = new HashMap<>(); /** * Creates FileReportSettings object. - * - * @param fileReportInfo the Information that should be included about each + * + * @param fileReportInfo The information that should be included about each * file in the report. */ FileReportSettings(Map fileReportInfo) { this.filePropertiesInfo = fileReportInfo; } - + + /** + * Gets file report settings. + * + * @return File report settings + */ Map getFileProperties() { return filePropertiesInfo; } diff --git a/Core/src/org/sleuthkit/autopsy/report/ModuleStatus.java b/Core/src/org/sleuthkit/autopsy/report/ModuleStatus.java index d034f9dced..9f68088c43 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ModuleStatus.java +++ b/Core/src/org/sleuthkit/autopsy/report/ModuleStatus.java @@ -21,10 +21,10 @@ package org.sleuthkit.autopsy.report; import java.io.Serializable; /** - * Class for persisting information about ReportModule (e.g. whether the report + * Class for persisting information about a report module (e.g. whether the report * module is enabled). */ -class ModuleStatus implements Serializable { +final class ModuleStatus implements Serializable { private static final long serialVersionUID = 1L; private final String moduleName; @@ -33,8 +33,8 @@ class ModuleStatus implements Serializable { /** * Creates ModuleStatus object. * - * @param module implementation of a ReportModule interface - * @param enabled boolean flag whether the module is enabled + * @param module Implementation of a ReportModule interface + * @param enabled Boolean flag whether the module is enabled */ ModuleStatus(ReportModule module, boolean enabled) { this.moduleName = module.getClass().getCanonicalName(); diff --git a/Core/src/org/sleuthkit/autopsy/report/NoReportModuleSettings.java b/Core/src/org/sleuthkit/autopsy/report/NoReportModuleSettings.java index 2528077cb5..ad5fd9a09f 100755 --- a/Core/src/org/sleuthkit/autopsy/report/NoReportModuleSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/NoReportModuleSettings.java @@ -20,7 +20,7 @@ package org.sleuthkit.autopsy.report; /** * Implementation of the ReportModuleSettings interface for use by report - * modules that do not have per report job options. + * modules that do not have settings. */ public final class NoReportModuleSettings implements ReportModuleSettings { diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportConfigException.java b/Core/src/org/sleuthkit/autopsy/report/ReportConfigException.java index 23ec6d1849..4d97f5b957 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportConfigException.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportConfigException.java @@ -20,9 +20,9 @@ package org.sleuthkit.autopsy.report; /** * Instances of this exception class are thrown when there is an error during - * serialization and deserialization of reporting configuration. + * serialization and deserialization of a reporting configuration. */ -class ReportConfigException extends Exception { +final class ReportConfigException extends Exception { private static final long serialVersionUID = 1L; diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel1.java b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel1.java index 4b148c930e..6cb00a7011 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportVisualPanel1.java @@ -22,9 +22,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.util.ArrayList; import static java.util.Collections.swap; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.logging.Level; import javax.swing.JList; import javax.swing.JPanel; @@ -35,7 +33,6 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.coreutils.Logger; @@ -70,14 +67,14 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { tableModules = ReportModuleLoader.getTableReportModules(); generalModules = ReportModuleLoader.getGeneralReportModules(); fileModules = ReportModuleLoader.getFileReportModules(); - + for (TableReportModule module : tableModules) { if (!moduleIsValid(module)) { popupWarning(module); - tableModules.remove(module); + tableModules.remove(module); } } - + for (GeneralReportModule module : generalModules) { if (!moduleIsValid(module)) { popupWarning(module); @@ -88,15 +85,15 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { for (FileReportModule module : fileModules) { if (!moduleIsValid(module)) { popupWarning(module); - fileModules.remove(module); + fileModules.remove(module); } } - + // our theory is that the report table modules are more common, so they go on top modules.addAll(tableModules); modules.addAll(fileModules); modules.addAll(generalModules); - + portableCaseModule = new PortableCaseReportModule(); if (moduleIsValid(portableCaseModule)) { modules.add(portableCaseModule); @@ -113,7 +110,7 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { indexOfHTMLReportModule++; } swap(modules, indexOfHTMLReportModule, 0); - + modulesJList.getSelectionModel().addListSelectionListener(this); modulesJList.setCellRenderer(new ModuleCellRenderer()); modulesJList.setListData(modules.toArray(new ReportModule[modules.size()])); @@ -181,7 +178,7 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { } return null; } - + /** * Get the selection status of the Portable Case report module. * @@ -303,7 +300,7 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener { configurationPanel.add(panel, BorderLayout.CENTER); configurationPanel.revalidate(); configurationPanel.repaint(); - + boolean generalModuleSelected = (module instanceof GeneralReportModule); wizPanel.setNext(!generalModuleSelected); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportingConfig.java b/Core/src/org/sleuthkit/autopsy/report/ReportingConfig.java index 2088c5ca36..c47590b0da 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportingConfig.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportingConfig.java @@ -25,7 +25,7 @@ import java.util.List; /** * A bundling of all the settings objects that define a report configuration. */ -class ReportingConfig implements Serializable { +final class ReportingConfig implements Serializable { private static final long serialVersionUID = 1L; private String configName; @@ -79,7 +79,7 @@ class ReportingConfig implements Serializable { this.fileReportSettings = settings; } - FileReportSettings getFileReportModuleSettings() { + FileReportSettings getFileReportSettings() { return this.fileReportSettings; } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportingConfigLoader.java b/Core/src/org/sleuthkit/autopsy/report/ReportingConfigLoader.java index 4811f613fe..fe647be153 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportingConfigLoader.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportingConfigLoader.java @@ -34,11 +34,11 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil; * all of the settings that make up a reporting configuration in an atomic, * thread safe way. */ -class ReportingConfigLoader { +final class ReportingConfigLoader { private static final String REPORT_CONFIG_FOLDER = "ReportingConfigs"; //NON-NLS private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ReportingConfigLoader.REPORT_CONFIG_FOLDER).toAbsolutePath().toString(); - private static final String REPORT_CONFIG_FILE_NAME = "ReportingConfiguration.properties"; + private static final String REPORT_CONFIG_FILE_EXTENSION = ".settings"; /** * Deserialize all of the settings that make up a reporting configuration in @@ -53,7 +53,7 @@ class ReportingConfigLoader { static synchronized ReportingConfig loadConfig(String configName) throws ReportConfigException { // construct the file path - Path reportFilePath = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH, configName, REPORT_CONFIG_FILE_NAME); + Path reportFilePath = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH, configName + REPORT_CONFIG_FILE_EXTENSION); File reportFile = reportFilePath.toFile(); // Return null if a reporting configuration for the given name does not exist. @@ -65,7 +65,7 @@ class ReportingConfigLoader { throw new ReportConfigException("Unable to read reporting configuration file " + reportFilePath.toString()); } - // read in the confuguration + // read in the configuration ReportingConfig config = null; try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(reportFilePath.toString()))) { config = (ReportingConfig) in.readObject(); @@ -87,7 +87,7 @@ class ReportingConfigLoader { static synchronized void saveConfig(ReportingConfig config) throws ReportConfigException { // construct the configuration directory path - Path pathToConfigDir = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH, config.getName()); + Path pathToConfigDir = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH); // create configuration directory try { @@ -97,11 +97,11 @@ class ReportingConfigLoader { } // save the configuration - String filePath = pathToConfigDir.toString() + File.separator + REPORT_CONFIG_FILE_NAME; + String filePath = pathToConfigDir.toString() + File.separator + config.getName() + REPORT_CONFIG_FILE_EXTENSION; try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { out.writeObject(config); } catch (IOException ex) { - throw new ReportConfigException("Unable to save reporting configuration " + pathToConfigDir.toString(), ex); + throw new ReportConfigException("Unable to save reporting configuration " + filePath, ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/TableReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/TableReportSettings.java index 5316b04a28..7817d70b83 100755 --- a/Core/src/org/sleuthkit/autopsy/report/TableReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/TableReportSettings.java @@ -28,7 +28,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact; * by the TableReportGenerator class to drive report generation by * TableReportModules. */ -class TableReportSettings implements Serializable { +final class TableReportSettings implements Serializable { private static final long serialVersionUID = 1L; private Map artifactTypeSelections = new HashMap<>(); @@ -37,9 +37,9 @@ class TableReportSettings implements Serializable { /** * Creates TableReportSettings object. * - * @param artifactTypeSelections the enabled/disabled state of the artifact + * @param artifactTypeSelections The enabled/disabled state of the artifact * types to be included in the report - * @param tagNameSelections the enabled/disabled state of the tag names to + * @param tagNameSelections The enabled/disabled state of the tag names to * be included in the report */ TableReportSettings(Map artifactTypeSelections, Map tagNameSelections) {