Skip to content
Snippets Groups Projects
Unverified Commit 9f94ac54 authored by Ann Priestman's avatar Ann Priestman Committed by GitHub
Browse files

Merge pull request #7201 from wschaeferB/7878-RemoveUnecessaryMD5Validation

7878 remove unnecessary MD5 validation and check against empty string
parents b4622c87 fc036145
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
...@@ -259,9 +260,8 @@ public String toString() { ...@@ -259,9 +260,8 @@ public String toString() {
@Override @Override
public int hashCode() { public int hashCode() {
if (this.getFirstInstance().getMd5Hash() == null if (StringUtils.isBlank(this.getFirstInstance().getMd5Hash())
|| HashUtility.isNoDataMd5(this.getFirstInstance().getMd5Hash()) || HashUtility.isNoDataMd5(this.getFirstInstance().getMd5Hash())) {
|| !HashUtility.isValidMd5Hash(this.getFirstInstance().getMd5Hash())) {
return super.hashCode(); return super.hashCode();
} else { } else {
//if the file has a valid MD5 use the hashcode of the MD5 for deduping files with the same MD5 //if the file has a valid MD5 use the hashcode of the MD5 for deduping files with the same MD5
...@@ -273,9 +273,8 @@ public int hashCode() { ...@@ -273,9 +273,8 @@ public int hashCode() {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof ResultFile) if (!(obj instanceof ResultFile)
|| this.getFirstInstance().getMd5Hash() == null || StringUtils.isBlank(this.getFirstInstance().getMd5Hash())
|| HashUtility.isNoDataMd5(this.getFirstInstance().getMd5Hash()) || HashUtility.isNoDataMd5(this.getFirstInstance().getMd5Hash())) {
|| !HashUtility.isValidMd5Hash(this.getFirstInstance().getMd5Hash())) {
return super.equals(obj); return super.equals(obj);
} else { } else {
//if the file has a valid MD5 compare use the MD5 for equality check //if the file has a valid MD5 compare use the MD5 for equality check
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment