checkstyle corrections

This commit is contained in:
Jeremy Long
2017-05-27 12:06:49 -04:00
parent d5df4920c7
commit 1b14c10085
5 changed files with 11 additions and 10 deletions

View File

@@ -815,7 +815,7 @@ public class Engine implements FileFilter {
public void writeReports(String applicationName, String groupId, String artifactId, public void writeReports(String applicationName, String groupId, String artifactId,
String version, File outputDir, String format) throws ReportException { String version, File outputDir, String format) throws ReportException {
DatabaseProperties prop = database.getDatabaseProperties(); final DatabaseProperties prop = database.getDatabaseProperties();
final ReportGenerator r = new ReportGenerator(applicationName, groupId, artifactId, version, dependencies, getAnalyzers(), prop); final ReportGenerator r = new ReportGenerator(applicationName, groupId, artifactId, version, dependencies, getAnalyzers(), prop);
try { try {
r.write(outputDir.getAbsolutePath(), format); r.write(outputDir.getAbsolutePath(), format);

View File

@@ -18,12 +18,9 @@
package org.owasp.dependencycheck.agent; package org.owasp.dependencycheck.agent;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.List; import java.util.List;
import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.data.nvdcve.CveDB;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException; import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.dependency.Identifier; import org.owasp.dependencycheck.dependency.Identifier;
import org.owasp.dependencycheck.dependency.Vulnerability; import org.owasp.dependencycheck.dependency.Vulnerability;

View File

@@ -95,6 +95,9 @@ public final class CveDB implements AutoCloseable {
*/ */
private final EnumMap<PreparedStatementCveDb, PreparedStatement> preparedStatements = new EnumMap<>(PreparedStatementCveDb.class); private final EnumMap<PreparedStatementCveDb, PreparedStatement> preparedStatements = new EnumMap<>(PreparedStatementCveDb.class);
/**
* Cache for CVE lookups; used to speed up the vulnerability search process.
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private final Map<String, List<Vulnerability>> vulnerabilitiesForCpeCache = Collections.synchronizedMap(new ReferenceMap(HARD, SOFT)); private final Map<String, List<Vulnerability>> vulnerabilitiesForCpeCache = Collections.synchronizedMap(new ReferenceMap(HARD, SOFT));
@@ -508,8 +511,9 @@ public final class CveDB implements AutoCloseable {
} }
/** /**
* Clears cache. Should be called whenever something is modified. While this is not the optimal cache eviction * Clears cache. Should be called whenever something is modified. While this
* strategy, this is good enough for typical usage (update DB and then only read) and it is easier to maintain * is not the optimal cache eviction strategy, this is good enough for
* typical usage (update DB and then only read) and it is easier to maintain
* the code. * the code.
* *
* It should be also called when DB is closed. * It should be also called when DB is closed.

View File

@@ -124,7 +124,7 @@ public class EscapeTool {
return ""; return "";
} }
boolean addComma = false; boolean addComma = false;
StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
for (Identifier id : ids) { for (Identifier id : ids) {
if (!"cpe".equals(id.getType())) { if (!"cpe".equals(id.getType())) {
if (addComma) { if (addComma) {
@@ -150,7 +150,7 @@ public class EscapeTool {
return ""; return "";
} }
boolean addComma = false; boolean addComma = false;
StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
for (Identifier id : ids) { for (Identifier id : ids) {
if ("cpe".equals(id.getType())) { if ("cpe".equals(id.getType())) {
if (addComma) { if (addComma) {

View File

@@ -169,7 +169,7 @@ public class ReportGenerator {
final String scanDate = dateFormat.print(dt); final String scanDate = dateFormat.print(dt);
final String scanDateXML = dateFormatXML.print(dt); final String scanDateXML = dateFormatXML.print(dt);
VelocityContext ctxt = new VelocityContext(); final VelocityContext ctxt = new VelocityContext();
ctxt.put("applicationName", applicationName); ctxt.put("applicationName", applicationName);
ctxt.put("dependencies", dependencies); ctxt.put("dependencies", dependencies);
ctxt.put("analyzers", analyzers); ctxt.put("analyzers", analyzers);
@@ -202,7 +202,7 @@ public class ReportGenerator {
if (reportFormat != null) { if (reportFormat != null) {
write(outputLocation, reportFormat); write(outputLocation, reportFormat);
} else { } else {
File out = getReportFile(outputLocation, null); final File out = getReportFile(outputLocation, null);
if (out.isDirectory()) { if (out.isDirectory()) {
throw new ReportException("Unable to write non-standard VSL output to a directory, please specify a file name"); throw new ReportException("Unable to write non-standard VSL output to a directory, please specify a file name");
} }