From 19bdec6a0faab6618c805b51852a75ddafbe7ce8 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 17 Mar 2016 12:41:50 -0400 Subject: [PATCH] Fixed file size condition limitation on 0 case (= 0 bytes is now allowed). --- .../autopsy/modules/interestingitems/FilesSet.java | 4 +--- .../autopsy/modules/interestingitems/FilesSetRulePanel.java | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index de807b0672..f207e720d2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -354,7 +354,6 @@ final class FilesSet implements Serializable { private static final long serialVersionUID = 1L; - /** * Represents a comparison item for file size */ @@ -442,7 +441,7 @@ final class FilesSet implements Serializable { this.unit = unit; this.sizeValue = sizeValue; } - + /** * Gets the comparator of this condition * @@ -470,7 +469,6 @@ final class FilesSet implements Serializable { return sizeValue; } - @Override public boolean passes(AbstractFile file) { long fileSize = file.getSize(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index fb52eb0354..fba97d318b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -55,7 +55,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { "FilesSetRulePanel.NoMimeTypeError=Please select a valid MIME type.", "FilesSetRulePanel.NoNameError=Name cannot be empty", "FilesSetRulePanel.NoPathError=Path cannot be empty", - "FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0." + "FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0 (Unless = is selected)." }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); @@ -362,7 +362,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } } if (this.fileSizeCheck.isSelected()) { - if ((Integer) this.fileSizeSpinner.getValue() == 0) { + if ((Integer) this.fileSizeSpinner.getValue() == 0 && !((String)this.equalitySymbolComboBox.getSelectedItem()).equals("=")) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( Bundle.FilesSetRulePanel_ZeroFileSizeError(), NotifyDescriptor.WARNING_MESSAGE); @@ -443,7 +443,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { */ FilesSet.Rule.FileSizeCondition getFileSizeCondition() { FilesSet.Rule.FileSizeCondition condition = null; - if ((Integer) this.fileSizeSpinner.getValue() != 0) { + if ((Integer) this.fileSizeSpinner.getValue() != 0 || ((String)this.equalitySymbolComboBox.getSelectedItem()).equals("=")) { FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem()); FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem()); int fileSizeValue = (Integer) this.fileSizeSpinner.getValue();