mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-24 01:51:49 +01:00
add a new constructor to accept a DatabaseProperties argument and deprecated the old constructor
Former-commit-id: 66a7a7f94152712e1bace2a53cf01f72b9f4a772
This commit is contained in:
@@ -36,6 +36,7 @@ import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
|
|||||||
import org.apache.velocity.tools.ToolManager;
|
import org.apache.velocity.tools.ToolManager;
|
||||||
import org.apache.velocity.tools.config.EasyFactoryConfiguration;
|
import org.apache.velocity.tools.config.EasyFactoryConfiguration;
|
||||||
import org.owasp.dependencycheck.analyzer.Analyzer;
|
import org.owasp.dependencycheck.analyzer.Analyzer;
|
||||||
|
import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
|
||||||
import org.owasp.dependencycheck.dependency.Dependency;
|
import org.owasp.dependencycheck.dependency.Dependency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,9 +83,10 @@ public class ReportGenerator {
|
|||||||
*
|
*
|
||||||
* @param applicationName the application name being analyzed
|
* @param applicationName the application name being analyzed
|
||||||
* @param dependencies the list of dependencies
|
* @param dependencies the list of dependencies
|
||||||
* @param analyzers the list of analyzers used.
|
* @param analyzers the list of analyzers used
|
||||||
|
* @param properties the database properties (containing timestamps of the NVD CVE data)
|
||||||
*/
|
*/
|
||||||
public ReportGenerator(String applicationName, List<Dependency> dependencies, List<Analyzer> analyzers) {
|
public ReportGenerator(String applicationName, List<Dependency> dependencies, List<Analyzer> analyzers, DatabaseProperties properties) {
|
||||||
engine = createVelocityEngine();
|
engine = createVelocityEngine();
|
||||||
context = createContext();
|
context = createContext();
|
||||||
|
|
||||||
@@ -93,6 +95,21 @@ public class ReportGenerator {
|
|||||||
context.put("applicationName", applicationName);
|
context.put("applicationName", applicationName);
|
||||||
context.put("dependencies", dependencies);
|
context.put("dependencies", dependencies);
|
||||||
context.put("analyzers", analyzers);
|
context.put("analyzers", analyzers);
|
||||||
|
context.put("properties", properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new ReportGenerator. This implementation has been left in so tat backward compatability is not
|
||||||
|
* broken. However, this constructor should no longer be used.
|
||||||
|
*
|
||||||
|
* @param applicationName the application name being analyzed
|
||||||
|
* @param dependencies the list of dependencies
|
||||||
|
* @param analyzers the list of analyzers used
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public ReportGenerator(String applicationName, List<Dependency> dependencies, List<Analyzer> analyzers) {
|
||||||
|
this(applicationName, dependencies, analyzers, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,20 +243,20 @@ public class ReportGenerator {
|
|||||||
if (writer != null) {
|
if (writer != null) {
|
||||||
try {
|
try {
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (Exception ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (outputStream != null) {
|
if (outputStream != null) {
|
||||||
try {
|
try {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (Exception ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (Exception ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user