cleaned up code to use isEmpty instead of "".equals(string)

Former-commit-id: 8469f91a948ab2ab5b0ce61865a0b11cd6d11717
This commit is contained in:
Jeremy Long
2014-10-25 08:06:56 -04:00
parent c86b821951
commit 9df8bdff5f

View File

@@ -26,7 +26,6 @@ import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.owasp.dependencycheck.data.nexus.MavenArtifact; import org.owasp.dependencycheck.data.nexus.MavenArtifact;
import org.owasp.dependencycheck.utils.Checksum; import org.owasp.dependencycheck.utils.Checksum;
import org.owasp.dependencycheck.utils.FileUtils; import org.owasp.dependencycheck.utils.FileUtils;
@@ -320,21 +319,22 @@ public class Dependency implements Serializable, Comparable<Dependency> {
/** /**
* Adds the maven artifact as evidence. * Adds the maven artifact as evidence.
* @param source The source of the evidence. *
* @param mavenArtifact The maven artifact. * @param source The source of the evidence
* @param confidence The confidence level of this evidence. * @param mavenArtifact The maven artifact
* @param confidence The confidence level of this evidence
*/ */
public void addAsEvidence(String source, MavenArtifact mavenArtifact, Confidence confidence) { public void addAsEvidence(String source, MavenArtifact mavenArtifact, Confidence confidence) {
if (mavenArtifact.getGroupId() != null && !"".equals(mavenArtifact.getGroupId())) { if (mavenArtifact.getGroupId() != null && !mavenArtifact.getGroupId().isEmpty()) {
this.getVendorEvidence().addEvidence(source, "groupid", mavenArtifact.getGroupId(), confidence); this.getVendorEvidence().addEvidence(source, "groupid", mavenArtifact.getGroupId(), confidence);
} }
if (mavenArtifact.getArtifactId() != null && !"".equals(mavenArtifact.getArtifactId())) { if (mavenArtifact.getArtifactId() != null && !mavenArtifact.getArtifactId().isEmpty()) {
this.getProductEvidence().addEvidence(source, "artifactid", mavenArtifact.getArtifactId(), confidence); this.getProductEvidence().addEvidence(source, "artifactid", mavenArtifact.getArtifactId(), confidence);
} }
if (mavenArtifact.getVersion() != null && !"".equals(mavenArtifact.getVersion())) { if (mavenArtifact.getVersion() != null && !mavenArtifact.getVersion().isEmpty()) {
this.getVersionEvidence().addEvidence(source, "version", mavenArtifact.getVersion(), confidence); this.getVersionEvidence().addEvidence(source, "version", mavenArtifact.getVersion(), confidence);
} }
if (mavenArtifact.getArtifactUrl() != null && !"".equals(mavenArtifact.getArtifactUrl())) { if (mavenArtifact.getArtifactUrl() != null && !mavenArtifact.getArtifactUrl().isEmpty()) {
boolean found = false; boolean found = false;
for (Identifier i : this.getIdentifiers()) { for (Identifier i : this.getIdentifiers()) {
if ("maven".equals(i.getType()) && i.getValue().equals(mavenArtifact.toString())) { if ("maven".equals(i.getType()) && i.getValue().equals(mavenArtifact.toString())) {