mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 09:09:31 +01:00
fixed issues related to making the cveDb a singleton
This commit is contained in:
@@ -941,14 +941,11 @@ public class Check extends Update {
|
||||
}
|
||||
}
|
||||
DatabaseProperties prop = null;
|
||||
try {
|
||||
final CveDB cve = CveDB.getInstance();
|
||||
try (CveDB cve = CveDB.getInstance()) {
|
||||
prop = cve.getDatabaseProperties();
|
||||
} catch (DatabaseException ex) {
|
||||
//TODO shouldn't this be a fatal exception
|
||||
log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG);
|
||||
} finally {
|
||||
CveDB.close();
|
||||
}
|
||||
|
||||
final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop);
|
||||
|
||||
@@ -33,7 +33,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.owasp.dependencycheck.data.nvdcve.CveDB;
|
||||
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jeremy Long
|
||||
@@ -50,7 +49,6 @@ public class DependencyCheckTaskTest {
|
||||
public void setUp() throws Exception {
|
||||
Settings.initialize();
|
||||
BaseDBTestCase.ensureDBExists();
|
||||
CveDB.getInstance().openDatabase();
|
||||
final String buildFile = this.getClass().getClassLoader().getResource("build.xml").getPath();
|
||||
buildFileRule.configureProject(buildFile);
|
||||
}
|
||||
@@ -60,10 +58,6 @@ public class DependencyCheckTaskTest {
|
||||
//no cleanup...
|
||||
//executeTarget("cleanup");
|
||||
Settings.cleanup(true);
|
||||
try {
|
||||
CveDB.getInstance().closeDatabase();
|
||||
} catch (DatabaseException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user