mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-19 10:07:12 +01:00
Applied patch from Steve to change the loading of the H2 db
Former-commit-id: 46d4bd628f0d7ecfaffc7881f8bc47bee6c55a5f
This commit is contained in:
@@ -182,13 +182,14 @@ public class CveDB {
|
|||||||
* @throws SQLException thrown if there is a SQL Exception
|
* @throws SQLException thrown if there is a SQL Exception
|
||||||
* @throws DatabaseException thrown if there is an error initializing a new database
|
* @throws DatabaseException thrown if there is an error initializing a new database
|
||||||
*/
|
*/
|
||||||
public void open() throws IOException, SQLException, DatabaseException {
|
public void open() throws IOException, SQLException, DatabaseException, ClassNotFoundException {
|
||||||
final String fileName = CveDB.getDataDirectory().getCanonicalPath()
|
final String fileName = CveDB.getDataDirectory().getCanonicalPath()
|
||||||
+ File.separator
|
+ File.separator
|
||||||
+ "cve";
|
+ "cve";
|
||||||
final File f = new File(fileName);
|
final File f = new File(fileName);
|
||||||
final boolean createTables = !f.exists();
|
final boolean createTables = !f.exists();
|
||||||
final String connStr = "jdbc:h2:file:" + fileName;
|
final String connStr = "jdbc:h2:file:" + fileName;
|
||||||
|
Class.forName("org.h2.Driver");
|
||||||
conn = DriverManager.getConnection(connStr, "sa", "");
|
conn = DriverManager.getConnection(connStr, "sa", "");
|
||||||
if (createTables) {
|
if (createTables) {
|
||||||
createTables();
|
createTables();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class NvdCveAnalyzer implements Analyzer {
|
|||||||
* @throws IOException thrown when there is an IO Exception
|
* @throws IOException thrown when there is an IO Exception
|
||||||
* @throws DatabaseException thrown when there is a database exceptions
|
* @throws DatabaseException thrown when there is a database exceptions
|
||||||
*/
|
*/
|
||||||
public void open() throws SQLException, IOException, DatabaseException {
|
public void open() throws SQLException, IOException, DatabaseException, ClassNotFoundException {
|
||||||
cveDB = new CveDB();
|
cveDB = new CveDB();
|
||||||
cveDB.open();
|
cveDB.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ public class DatabaseUpdater implements CachedWebDataSource {
|
|||||||
throw new UpdateException(ex);
|
throw new UpdateException(ex);
|
||||||
} catch (DatabaseException ex) {
|
} catch (DatabaseException ex) {
|
||||||
throw new UpdateException(ex);
|
throw new UpdateException(ex);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
throw new UpdateException(ex);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (outputPath != null && outputPath.exists()) {
|
if (outputPath != null && outputPath.exists()) {
|
||||||
@@ -181,7 +183,7 @@ public class DatabaseUpdater implements CachedWebDataSource {
|
|||||||
* @throws DatabaseException is thrown if there is a database exception
|
* @throws DatabaseException is thrown if there is a database exception
|
||||||
*/
|
*/
|
||||||
private void importXML(File file, File oldVersion)
|
private void importXML(File file, File oldVersion)
|
||||||
throws ParserConfigurationException, SAXException, IOException, SQLException, DatabaseException {
|
throws ParserConfigurationException, SAXException, IOException, SQLException, DatabaseException, ClassNotFoundException {
|
||||||
CveDB cveDB = null;
|
CveDB cveDB = null;
|
||||||
Index cpeIndex = null;
|
Index cpeIndex = null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user