mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-25 02:21:28 +01:00
improved update failure reporting
This commit is contained in:
@@ -315,7 +315,7 @@ public final class ConnectionFactory {
|
|||||||
}
|
}
|
||||||
reader = new InputStreamReader(is, "UTF-8");
|
reader = new InputStreamReader(is, "UTF-8");
|
||||||
in = new BufferedReader(reader);
|
in = new BufferedReader(reader);
|
||||||
final StringBuilder sb = new StringBuilder(2110);
|
final StringBuilder sb = new StringBuilder(is.available());
|
||||||
String tmp;
|
String tmp;
|
||||||
while ((tmp = in.readLine()) != null) {
|
while ((tmp = in.readLine()) != null) {
|
||||||
sb.append(tmp);
|
sb.append(tmp);
|
||||||
@@ -323,7 +323,10 @@ public final class ConnectionFactory {
|
|||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
try {
|
try {
|
||||||
statement = conn.createStatement();
|
statement = conn.createStatement();
|
||||||
statement.execute(sb.toString());
|
boolean success = statement.execute(sb.toString());
|
||||||
|
if (!success && statement.getUpdateCount() <= 0) {
|
||||||
|
throw new DatabaseException(String.format("Unable to upgrade the database schema to %s", schema));
|
||||||
|
}
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
LOGGER.debug("", ex);
|
LOGGER.debug("", ex);
|
||||||
throw new DatabaseException("Unable to update database schema", ex);
|
throw new DatabaseException("Unable to update database schema", ex);
|
||||||
|
|||||||
Reference in New Issue
Block a user