diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index ee526067d5..82bdad5213 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -257,7 +257,7 @@ - + @@ -272,23 +272,25 @@ - + + - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 075dc50576..8779f7eb16 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -602,7 +602,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel5.text")); // NOI18N mimeTypeComboBox.setEditable(true); - mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -610,10 +610,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySymbolComboBox.setEnabled(false); - fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); + fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); fileSizeComboBox.setEnabled(false); fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); @@ -858,10 +858,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton dirsRadio; - private javax.swing.JComboBox equalitySymbolComboBox; + private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JCheckBox fileSizeCheck; - private javax.swing.JComboBox fileSizeComboBox; + private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; private javax.swing.JRadioButton filesAndDirsRadio; private javax.swing.JRadioButton filesRadio; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index f6178b3f3a..621ea791e9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -209,11 +209,19 @@ final class InterestingItemDefsManager extends Observable { private static Map readSerializedDefinitions() { String filePath = INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH; - try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath.toString()))) { - Map filesSetMap = (Map) in.readObject(); - return filesSetMap; - } catch (IOException | ClassNotFoundException ex) { - throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + File fileSetFile = new File(filePath); + if (fileSetFile.exists()) { + try { + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath))) { + InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); + return filesSetsSettings.getFilesSets(); + } + } catch (IOException | ClassNotFoundException ex) { + throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + } + } + else { + return new HashMap(); } } @@ -519,7 +527,7 @@ final class InterestingItemDefsManager extends Observable { // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { - out.writeObject(interestingFilesSets); + out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); if (xmlFile.exists()) { xmlFile.delete(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 26762d98c5..e55060f6a1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -775,10 +775,13 @@ - + + + + @@ -790,7 +793,7 @@ - + @@ -807,12 +810,13 @@ - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 655784592d..83301b6239 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -496,7 +496,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel7 = new javax.swing.JLabel(); - mimeTypeComboBox = new javax.swing.JComboBox(); + mimeTypeComboBox = new javax.swing.JComboBox(); jLabel8 = new javax.swing.JLabel(); equalitySignComboBox = new javax.swing.JComboBox(); jSpinner1 = new javax.swing.JSpinner(); @@ -690,17 +690,17 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel7.text")); // NOI18N mimeTypeComboBox.setEditable(true); - mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel8.text")); // NOI18N - equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySignComboBox.setEnabled(false); jSpinner1.setEnabled(false); - fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); + fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); @@ -954,7 +954,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JRadioButton fileNameRadioButton; private javax.swing.JCheckBox fileNameRegexCheckbox; private javax.swing.JTextField fileNameTextField; - private javax.swing.JComboBox fileSizeUnitComboBox; + private javax.swing.JComboBox fileSizeUnitComboBox; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JCheckBox ignoreKnownFilesCheckbox; private javax.swing.JLabel jLabel1; @@ -970,7 +970,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JScrollPane jScrollPane2; private javax.swing.JSpinner jSpinner1; private javax.swing.JTextArea jTextArea1; - private javax.swing.JComboBox mimeTypeComboBox; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; private javax.swing.JCheckBox rulePathConditionRegexCheckBox; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java new file mode 100755 index 0000000000..ab8381ed9b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.io.Serializable; +import java.util.Map; + +/** + * + * @author oliver + */ +class InterestingItemsFilesSetSettings implements Serializable { + private static final long serialVersionUID = 1L; + private Map filesSets; + InterestingItemsFilesSetSettings(Map filesSets) { + this.filesSets = filesSets; + } + + /** + * @return the filesSets + */ + Map getFilesSets() { + return filesSets; + } + + + +}