diff --git a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.java b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.java index 15b1430dc..821afff07 100644 --- a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.java +++ b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.java @@ -24,17 +24,12 @@ import org.slf4j.helpers.MarkerIgnoringBase; import org.slf4j.helpers.MessageFormatter; /** - * An instance of {@link org.slf4j.Logger} which simply calls the log method on the delegate Ant task + * An instance of {@link org.slf4j.Logger} which simply calls the log method on the delegate Ant task. * * @author colezlaw */ public class AntLoggerAdapter extends MarkerIgnoringBase { - /** - * The serial version UID for serialization. - */ - private static final long serialVersionUID = 1L; - /** * A reference to the Ant task used for logging. */ diff --git a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java index 005553ca6..179c194ad 100644 --- a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java +++ b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java @@ -146,6 +146,8 @@ public class Check extends Update { * Get the value of applicationName. * * @return the value of applicationName + * + * @deprecated use projectName instead. */ @Deprecated public String getApplicationName() { @@ -156,12 +158,15 @@ public class Check extends Update { * Set the value of applicationName. * * @param applicationName new value of applicationName + * @deprecated use projectName instead. */ @Deprecated public void setApplicationName(String applicationName) { this.applicationName = applicationName; } - + /** + * The name of the project being analyzed. + */ private String projectName = "dependency-check"; /** @@ -441,7 +446,7 @@ public class Check extends Update { private boolean composerAnalyzerEnabled = true; /** - * Get the value of composerAnalyzerEnabled + * Get the value of composerAnalyzerEnabled. * * @return the value of composerAnalyzerEnabled */ @@ -450,18 +455,20 @@ public class Check extends Update { } /** - * Set the value of composerAnalyzerEnabled + * Set the value of composerAnalyzerEnabled. * * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled */ public void setComposerAnalyzerEnabled(boolean composerAnalyzerEnabled) { this.composerAnalyzerEnabled = composerAnalyzerEnabled; } - + /** + * Whether the autoconf analyzer should be enabled. + */ private boolean autoconfAnalyzerEnabled = true; /** - * Get the value of autoconfAnalyzerEnabled + * Get the value of autoconfAnalyzerEnabled. * * @return the value of autoconfAnalyzerEnabled */ @@ -470,18 +477,20 @@ public class Check extends Update { } /** - * Set the value of autoconfAnalyzerEnabled + * Set the value of autoconfAnalyzerEnabled. * * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled */ public void setAutoconfAnalyzerEnabled(boolean autoconfAnalyzerEnabled) { this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled; } - + /** + * Whether the CMake analyzer should be enabled. + */ private boolean cmakeAnalyzerEnabled = true; /** - * Get the value of cmakeAnalyzerEnabled + * Get the value of cmakeAnalyzerEnabled. * * @return the value of cmakeAnalyzerEnabled */ @@ -490,7 +499,7 @@ public class Check extends Update { } /** - * Set the value of cmakeAnalyzerEnabled + * Set the value of cmakeAnalyzerEnabled. * * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled */ @@ -503,7 +512,7 @@ public class Check extends Update { private boolean opensslAnalyzerEnabled = true; /** - * Get the value of opensslAnalyzerEnabled + * Get the value of opensslAnalyzerEnabled. * * @return the value of opensslAnalyzerEnabled */ @@ -512,7 +521,7 @@ public class Check extends Update { } /** - * Set the value of opensslAnalyzerEnabled + * Set the value of opensslAnalyzerEnabled. * * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled */ @@ -525,7 +534,7 @@ public class Check extends Update { private boolean nodeAnalyzerEnabled = true; /** - * Get the value of nodeAnalyzerEnabled + * Get the value of nodeAnalyzerEnabled. * * @return the value of nodeAnalyzerEnabled */ @@ -534,18 +543,20 @@ public class Check extends Update { } /** - * Set the value of nodeAnalyzerEnabled + * Set the value of nodeAnalyzerEnabled. * * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled */ public void setNodeAnalyzerEnabled(boolean nodeAnalyzerEnabled) { this.nodeAnalyzerEnabled = nodeAnalyzerEnabled; } - + /** + * Whether the ruby gemspec analyzer should be enabled. + */ private boolean rubygemsAnalyzerEnabled = true; /** - * Get the value of rubygemsAnalyzerEnabled + * Get the value of rubygemsAnalyzerEnabled. * * @return the value of rubygemsAnalyzerEnabled */ @@ -554,18 +565,20 @@ public class Check extends Update { } /** - * Set the value of rubygemsAnalyzerEnabled + * Set the value of rubygemsAnalyzerEnabled. * * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled */ public void setRubygemsAnalyzerEnabled(boolean rubygemsAnalyzerEnabled) { this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled; } - + /** + * Whether the python package analyzer should be enabled. + */ private boolean pyPackageAnalyzerEnabled = true; /** - * Get the value of pyPackageAnalyzerEnabled + * Get the value of pyPackageAnalyzerEnabled. * * @return the value of pyPackageAnalyzerEnabled */ @@ -574,7 +587,7 @@ public class Check extends Update { } /** - * Set the value of pyPackageAnalyzerEnabled + * Set the value of pyPackageAnalyzerEnabled. * * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled */ @@ -582,10 +595,13 @@ public class Check extends Update { this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled; } + /** + * Whether the python distribution analyzer should be enabled. + */ private boolean pyDistributionAnalyzerEnabled = true; /** - * Get the value of pyDistributionAnalyzerEnabled + * Get the value of pyDistributionAnalyzerEnabled. * * @return the value of pyDistributionAnalyzerEnabled */ @@ -594,7 +610,7 @@ public class Check extends Update { } /** - * Set the value of pyDistributionAnalyzerEnabled + * Set the value of pyDistributionAnalyzerEnabled. * * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled */ diff --git a/dependency-check-cli/src/main/java/org/owasp/dependencycheck/CliParser.java b/dependency-check-cli/src/main/java/org/owasp/dependencycheck/CliParser.java index 235733ede..3364b53bc 100644 --- a/dependency-check-cli/src/main/java/org/owasp/dependencycheck/CliParser.java +++ b/dependency-check-cli/src/main/java/org/owasp/dependencycheck/CliParser.java @@ -327,8 +327,8 @@ public final class CliParser { .desc("The path to Mono for .NET Assembly analysis on non-windows systems.") .build(); - final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg().longOpt(ARGUMENT.CONNECTION_TIMEOUT) - .desc("The connection timeout (in milliseconds) to use when downloading resources.") + final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg() + .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.") .build(); final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER) @@ -737,7 +737,7 @@ public final class CliParser { * @return the application name. */ public String getProjectName() { - String appName = line.getOptionValue(ARGUMENT.APP_NAME); + final String appName = line.getOptionValue(ARGUMENT.APP_NAME); String name = line.getOptionValue(ARGUMENT.PROJECT); if (name == null && appName != null) { name = appName; @@ -1021,11 +1021,15 @@ public final class CliParser { public static final String PROJECT = "project"; /** * The long CLI argument name specifying the name of the application to be scanned. + * + * @deprecated project should be used instead */ @Deprecated public static final String APP_NAME = "app"; /** * The short CLI argument name specifying the name of the application to be scanned. + * + * @deprecated project should be used instead */ @Deprecated public static final String APP_NAME_SHORT = "a"; diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.java index c99b1bcaa..b88323f36 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.java @@ -19,6 +19,7 @@ package org.owasp.dependencycheck.data.lucene; import java.io.IOException; import java.util.LinkedList; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; @@ -75,8 +76,8 @@ public final class TokenPairConcatenatingFilter extends TokenFilter { } /** - * Increments the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by - * concatenating tokens with the previous token. + * Increments the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by concatenating + * tokens with the previous token. * * @return whether or not we have hit the end of the TokenStream * @throws IOException is thrown when an IOException occurs @@ -112,8 +113,7 @@ public final class TokenPairConcatenatingFilter extends TokenFilter { /** *

- * Resets the Filter and clears any internal state data that may have been left-over from previous uses of the - * Filter.

+ * Resets the Filter and clears any internal state data that may have been left-over from previous uses of the Filter.

*

* If this Filter is re-used this method must be called between uses.

*/ @@ -121,4 +121,46 @@ public final class TokenPairConcatenatingFilter extends TokenFilter { previousWord = null; words.clear(); } + + /** + * Standard hash code implementation. + * + * @return the hash code + */ + @Override + public int hashCode() { + int hash = 3; + hash = 31 * hash + (this.termAtt != null ? this.termAtt.hashCode() : 0); + hash = 31 * hash + (this.previousWord != null ? this.previousWord.hashCode() : 0); + hash = 31 * hash + (this.words != null ? this.words.hashCode() : 0); + return hash; + } + + /** + * Standard equals implementation. + * + * @param obj the object to compare + * @return true if the objects are equal; otherwise false. + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TokenPairConcatenatingFilter other = (TokenPairConcatenatingFilter) obj; + if (this.termAtt != other.termAtt && (this.termAtt == null || !this.termAtt.equals(other.termAtt))) { + return false; + } + if ((this.previousWord == null) ? (other.previousWord != null) : !this.previousWord.equals(other.previousWord)) { + return false; + } + if (this.words != other.words && (this.words == null || !this.words.equals(other.words))) { + return false; + } + return true; + } + } diff --git a/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java b/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java index 6f2b9054f..f1ab7b953 100644 --- a/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java +++ b/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java @@ -28,11 +28,6 @@ import org.slf4j.helpers.MessageFormatter; */ public class MavenLoggerAdapter extends MarkerIgnoringBase { - /** - * The serial version UID for serialization. - */ - private static final long serialVersionUID = 1L; - /** * A reference to the Maven log. */