if (++n >= 3) {\r
throw sqlEx;\r
}\r
- } finally {\r
- if (connection != null && !connection.isValid(1)) {\r
- connection.close();\r
- connection = null;\r
- }\r
}\r
} while (connection == null);\r
}\r
}\r
-\r
+ if (connection != null && !connection.isValid(1)) {\r
+ connection.close();\r
+ connection = null;\r
+ }\r
}\r
return connection;\r
}\r
connection = getConnection();\r
Set<String> actualTables = getTableSet(connection);\r
boolean initialize = false;\r
- for (String table : expectedTables) {\r
- initialize |= !actualTables.contains(table.toLowerCase());\r
+ for (String tableName : expectedTables) {\r
+ initialize |= !actualTables.contains(tableName);\r
}\r
if (initialize) {\r
intlogger.info("PROV9001: First time startup; The database is being initialized.");\r
* @return the set of table names\r
*/\r
private Set<String> getTableSet(Connection connection) {\r
- Set<String> tables = new HashSet<String>();\r
+ Set<String> tables = new HashSet<>();\r
try {\r
DatabaseMetaData md = connection.getMetaData();\r
ResultSet rs = md.getTables(null, null, "%", null);\r
if (rs != null) {\r
while (rs.next()) {\r
- tables.add(rs.getString("TABLE_NAME"));\r
+ tables.add(rs.getString("TABLE_NAME").toUpperCase());\r
}\r
rs.close();\r
}\r