mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-21 00:29:21 +01:00
updated error messages
Former-commit-id: 2b1c5e7560f30d1aaf2215bdc8997961a637d083
This commit is contained in:
@@ -96,9 +96,19 @@ public final class ConnectionFactory {
|
|||||||
//Class.forName("org.h2.Driver");
|
//Class.forName("org.h2.Driver");
|
||||||
conn = DriverManager.getConnection(connStr, user, pass);
|
conn = DriverManager.getConnection(connStr, user, pass);
|
||||||
if (createTables) {
|
if (createTables) {
|
||||||
createTables(conn);
|
try {
|
||||||
|
createTables(conn);
|
||||||
|
} catch (DatabaseException ex) {
|
||||||
|
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
||||||
|
throw new DatabaseException("Unable to create the database structure");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ensureSchemaVersion(conn);
|
try {
|
||||||
|
ensureSchemaVersion(conn);
|
||||||
|
} catch (DatabaseException ex) {
|
||||||
|
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
||||||
|
throw new DatabaseException("Database schema does not match this version of dependency-check");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
||||||
@@ -109,9 +119,6 @@ public final class ConnectionFactory {
|
|||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
||||||
throw new DatabaseException("Unable to connect to the database");
|
throw new DatabaseException("Unable to connect to the database");
|
||||||
} catch (DatabaseException ex) {
|
|
||||||
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, null, ex);
|
|
||||||
throw new DatabaseException("Unable to create the database structure");
|
|
||||||
}
|
}
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user