mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
DependencyCheck.equals() taking advantage of commons ObjectUtils now.
Former-commit-id: d72ed9b7ee7c0b634b64e90e902d7991534cde79
This commit is contained in:
@@ -27,6 +27,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.owasp.dependencycheck.data.nexus.MavenArtifact;
|
||||
import org.owasp.dependencycheck.utils.Checksum;
|
||||
import org.owasp.dependencycheck.utils.FileUtils;
|
||||
@@ -296,9 +298,9 @@ public class Dependency implements Serializable, Comparable<Dependency> {
|
||||
/**
|
||||
* Adds an entry to the list of detected Identifiers for the dependency file.
|
||||
*
|
||||
* @param type the type of identifier (such as CPE)
|
||||
* @param type the type of identifier (such as CPE)
|
||||
* @param value the value of the identifier
|
||||
* @param url the URL of the identifier
|
||||
* @param url the URL of the identifier
|
||||
*/
|
||||
public void addIdentifier(String type, String value, String url) {
|
||||
final Identifier i = new Identifier(type, value, url);
|
||||
@@ -308,9 +310,9 @@ public class Dependency implements Serializable, Comparable<Dependency> {
|
||||
/**
|
||||
* Adds an entry to the list of detected Identifiers for the dependency file.
|
||||
*
|
||||
* @param type the type of identifier (such as CPE)
|
||||
* @param value the value of the identifier
|
||||
* @param url the URL of the identifier
|
||||
* @param type the type of identifier (such as CPE)
|
||||
* @param value the value of the identifier
|
||||
* @param url the URL of the identifier
|
||||
* @param confidence the confidence in the Identifier being accurate
|
||||
*/
|
||||
public void addIdentifier(String type, String value, String url, Confidence confidence) {
|
||||
@@ -322,9 +324,9 @@ public class Dependency implements Serializable, Comparable<Dependency> {
|
||||
/**
|
||||
* Adds the maven artifact as evidence.
|
||||
*
|
||||
* @param source The source of the evidence
|
||||
* @param source The source of the evidence
|
||||
* @param mavenArtifact The maven artifact
|
||||
* @param confidence The confidence level of this evidence
|
||||
* @param confidence The confidence level of this evidence
|
||||
*/
|
||||
public void addAsEvidence(String source, MavenArtifact mavenArtifact, Confidence confidence) {
|
||||
if (mavenArtifact.getGroupId() != null && !mavenArtifact.getGroupId().isEmpty()) {
|
||||
@@ -720,59 +722,22 @@ public class Dependency implements Serializable, Comparable<Dependency> {
|
||||
return false;
|
||||
}
|
||||
final Dependency other = (Dependency) obj;
|
||||
if ((this.actualFilePath == null) ? (other.actualFilePath != null) : !this.actualFilePath.equals(other.actualFilePath)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.fileExtension == null) ? (other.fileExtension != null) : !this.fileExtension.equals(other.fileExtension)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.md5sum == null) ? (other.md5sum != null) : !this.md5sum.equals(other.md5sum)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.sha1sum == null) ? (other.sha1sum != null) : !this.sha1sum.equals(other.sha1sum)) {
|
||||
return false;
|
||||
}
|
||||
if (this.identifiers != other.identifiers && (this.identifiers == null || !this.identifiers.equals(other.identifiers))) {
|
||||
return false;
|
||||
}
|
||||
if (this.vendorEvidence != other.vendorEvidence && (this.vendorEvidence == null || !this.vendorEvidence.equals(other.vendorEvidence))) {
|
||||
return false;
|
||||
}
|
||||
if (this.productEvidence != other.productEvidence && (this.productEvidence == null || !this.productEvidence.equals(other.productEvidence))) {
|
||||
return false;
|
||||
}
|
||||
if (this.versionEvidence != other.versionEvidence && (this.versionEvidence == null || !this.versionEvidence.equals(other.versionEvidence))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.license == null) ? (other.license != null) : !this.license.equals(other.license)) {
|
||||
return false;
|
||||
}
|
||||
if (this.vulnerabilities != other.vulnerabilities && (this.vulnerabilities == null || !this.vulnerabilities.equals(other.vulnerabilities))) {
|
||||
return false;
|
||||
}
|
||||
if (this.relatedDependencies != other.relatedDependencies
|
||||
&& (this.relatedDependencies == null || !this.relatedDependencies.equals(other.relatedDependencies))) {
|
||||
return false;
|
||||
}
|
||||
if (this.projectReferences != other.projectReferences
|
||||
&& (this.projectReferences == null || !this.projectReferences.equals(other.projectReferences))) {
|
||||
return false;
|
||||
}
|
||||
if (this.availableVersions != other.availableVersions
|
||||
&& (this.availableVersions == null || !this.availableVersions.equals(other.availableVersions))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return ObjectUtils.equals(this.actualFilePath, other.actualFilePath) &&
|
||||
ObjectUtils.equals(this.filePath, other.filePath) &&
|
||||
ObjectUtils.equals(this.fileName, other.fileName) &&
|
||||
ObjectUtils.equals(this.fileExtension, other.fileExtension) &&
|
||||
ObjectUtils.equals(this.md5sum, other.md5sum) &&
|
||||
ObjectUtils.equals(this.sha1sum, other.sha1sum) &&
|
||||
ObjectUtils.equals(this.identifiers, other.identifiers) &&
|
||||
ObjectUtils.equals(this.vendorEvidence, other.vendorEvidence) &&
|
||||
ObjectUtils.equals(this.productEvidence, other.productEvidence) &&
|
||||
ObjectUtils.equals(this.versionEvidence, other.versionEvidence) &&
|
||||
ObjectUtils.equals(this.description, other.description) &&
|
||||
ObjectUtils.equals(this.license, other.license) &&
|
||||
ObjectUtils.equals(this.vulnerabilities, other.vulnerabilities) &&
|
||||
ObjectUtils.equals(this.relatedDependencies, other.relatedDependencies) &&
|
||||
ObjectUtils.equals(this.projectReferences, other.projectReferences) &&
|
||||
ObjectUtils.equals(this.availableVersions, other.availableVersions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user