changed CveDB to a singeton

This commit is contained in:
Jeremy Long
2017-03-07 05:49:12 -05:00
parent 5ed5764ab5
commit 679df936e7
26 changed files with 343 additions and 719 deletions

View File

@@ -1029,19 +1029,14 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
*/
protected void writeReports(Engine engine, MavenProject p, File outputDir) throws ReportException {
DatabaseProperties prop = null;
CveDB cve = null;
try {
cve = new CveDB();
cve.open();
final CveDB cve = CveDB.getInstance();
prop = cve.getDatabaseProperties();
} catch (DatabaseException ex) {
//TODO shouldn't this throw an exception?
if (getLog().isDebugEnabled()) {
getLog().debug("Unable to retrieve DB Properties", ex);
}
} finally {
if (cve != null) {
cve.close();
}
}
final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop);
try {