Applied patch from Steve to change the loading of the H2 db

Former-commit-id: 46d4bd628f0d7ecfaffc7881f8bc47bee6c55a5f
This commit is contained in:
Jeremy Long
2013-05-25 10:56:41 -04:00
parent 1b01b35b03
commit f7d6ca5c11
3 changed files with 6 additions and 3 deletions

View File

@@ -182,13 +182,14 @@ public class CveDB {
* @throws SQLException thrown if there is a SQL Exception
* @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()
+ File.separator
+ "cve";
final File f = new File(fileName);
final boolean createTables = !f.exists();
final String connStr = "jdbc:h2:file:" + fileName;
Class.forName("org.h2.Driver");
conn = DriverManager.getConnection(connStr, "sa", "");
if (createTables) {
createTables();

View File

@@ -54,7 +54,7 @@ public class NvdCveAnalyzer implements Analyzer {
* @throws IOException thrown when there is an IO Exception
* @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.open();
}

View File

@@ -137,6 +137,8 @@ public class DatabaseUpdater implements CachedWebDataSource {
throw new UpdateException(ex);
} catch (DatabaseException ex) {
throw new UpdateException(ex);
} catch (ClassNotFoundException ex) {
throw new UpdateException(ex);
} finally {
try {
if (outputPath != null && outputPath.exists()) {
@@ -181,7 +183,7 @@ public class DatabaseUpdater implements CachedWebDataSource {
* @throws DatabaseException is thrown if there is a database exception
*/
private void importXML(File file, File oldVersion)
throws ParserConfigurationException, SAXException, IOException, SQLException, DatabaseException {
throws ParserConfigurationException, SAXException, IOException, SQLException, DatabaseException, ClassNotFoundException {
CveDB cveDB = null;
Index cpeIndex = null;