Commit db214589 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Better logging/error checking.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4046 b35dd754-fafc-0310-a699-88a17e54d16e
parent d0cf65df
......@@ -136,22 +136,25 @@ public class SchemaManager {
pstmt = con.prepareStatement(CHECK_VERSION);
pstmt.setString(1, schemaKey);
ResultSet rs = pstmt.executeQuery();
rs.next();
if (rs.next()) {
currentVersion = rs.getInt(1);
}
rs.close();
}
catch (SQLException sqle) {
// Releases of Wildfire before 2.6.0 stored a major and minor version
// number so the normal check for version can fail. Check for the
// version using the old format in that case.
if (schemaKey.equals("wildfire")) {
try {
if (pstmt != null) {
pstmt.close();
}
pstmt = con.prepareStatement(CHECK_VERSION_OLD);
ResultSet rs = pstmt.executeQuery();
rs.next();
if (rs.next()) {
currentVersion = rs.getInt(1);
}
rs.close();
}
catch (SQLException sqle2) {
......@@ -159,6 +162,7 @@ public class SchemaManager {
Log.warn("Error verifying server version", sqle2);
}
}
}
finally {
try {
if (pstmt != null) {
......@@ -175,7 +179,7 @@ public class SchemaManager {
}
// If the database schema isn't installed at all, we need to install it.
else if (currentVersion == -1) {
Log.error(LocaleUtils.getLocalizedString("upgrade.database.missing_schema",
Log.info(LocaleUtils.getLocalizedString("upgrade.database.missing_schema",
Arrays.asList(schemaKey)));
System.out.println(LocaleUtils.getLocalizedString("upgrade.database.missing_schema",
Arrays.asList(schemaKey)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment