various IntelliJ analysis recommendations

Former-commit-id: 7b5f0b5c5e0fc37b58e7cecbcf190c0df56ffe0f
This commit is contained in:
Jeremy Long
2014-01-11 16:04:43 -05:00
parent 525933be99
commit fe072cd2e3
19 changed files with 12 additions and 42 deletions

View File

@@ -74,7 +74,7 @@ public class ArchiveAnalyzer extends AbstractAnalyzer implements Analyzer {
* Tracks the current scan/extraction depth for nested archives.
*/
private int scanDepth = 0;
//<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer">
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
/**
* The name of the analyzer.
*/

View File

@@ -286,10 +286,7 @@ public class DependencyBundlingAnalyzer extends AbstractAnalyzer implements Anal
final File rFile = new File(dependency2.getFilePath());
String right = rFile.getParent();
if (left == null) {
if (right == null) {
return true;
}
return false;
return right == null;
}
if (left.equalsIgnoreCase(right)) {
return true;
@@ -322,17 +319,13 @@ public class DependencyBundlingAnalyzer extends AbstractAnalyzer implements Anal
/*
* considered splitting the names up and comparing the components,
* but decided that the file name length should be sufficient as the
* "core" component, if this follows a normal namming protocol should
* "core" component, if this follows a normal naming protocol should
* be shorter:
* axis2-saaj-1.4.1.jar
* axis2-1.4.1.jar <-----
* axis2-kernal-1.4.1.jar
*/
if (leftName.length() > rightName.length()) {
returnVal = false;
} else {
returnVal = true;
}
returnVal = leftName.length() <= rightName.length();
}
if (LogUtils.isVerboseLoggingEnabled()) {
final String msg = String.format("IsCore=%s (%s, %s)", returnVal, left.getFileName(), right.getFileName());

View File

@@ -342,7 +342,7 @@ public class JarAnalyzer extends AbstractAnalyzer implements Analyzer {
* @return returns a
* @throws AnalysisException is thrown if there is an exception extracting
* or parsing the POM
* {@link org.owasp.dependencycheck.analyzer.pom.generated.Model} object
* {@link org.owasp.dependencycheck.jaxb.pom.generated.Model} object
*/
private Model retrievePom(String path, JarFile jar) throws AnalysisException {
final ZipEntry entry = jar.getEntry(path);

View File

@@ -726,7 +726,7 @@ public class CveDB {
boolean affected = false;
final boolean isStruts = "apache".equals(vendor) && "struts".equals(product);
final DependencyVersion v = parseDependencyVersion(cpeId);
final boolean prevAffected = previous == null ? false : !previous.isEmpty();
final boolean prevAffected = previous != null && !previous.isEmpty();
if (identifiedVersion == null || "-".equals(identifiedVersion.toString())) {
if (v == null || "-".equals(v.toString())) {
affected = true;

View File

@@ -103,7 +103,7 @@ public final class DriverLoader {
final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
@Override
public URLClassLoader run() {
return new URLClassLoader(urls.toArray(new URL[0]), parent);
return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent);
}
});

View File

@@ -18,7 +18,6 @@
*/
package org.owasp.dependencycheck.data.update.task;
import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
import java.io.File;
import java.io.IOException;
import java.net.URL;

View File

@@ -89,7 +89,7 @@ public class EvidenceCollection implements Iterable<Evidence> {
*
* @param confidence the confidence level for the evidence to be iterated
* over.
* @return Iterable<Evidence> an iterable collectoin of evidence
* @return Iterable<Evidence> an iterable collection of evidence
*/
public final Iterable<Evidence> iterator(Evidence.Confidence confidence) {
if (confidence == Evidence.Confidence.HIGHEST) {

View File

@@ -39,7 +39,7 @@ public class SuppressionErrorHandler implements ErrorHandler {
*/
private String getPrettyParseExceptionInfo(SAXParseException ex) {
final StringBuffer sb = new StringBuffer();
final StringBuilder sb = new StringBuilder();
if (ex.getSystemId() != null) {
sb.append("systemId=").append(ex.getSystemId()).append(", ");