mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-28 20:02:16 +01:00
checkstyle corrections
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user