Don't erase the original password array, erase the copy.

This commit is contained in:
akwizgran
2013-04-02 12:10:26 +01:00
parent 84c07a2b9c
commit 02c23f1378

View File

@@ -74,13 +74,14 @@ class H2Database extends JdbcDatabase {
@Override @Override
protected Connection createConnection() throws SQLException { protected Connection createConnection() throws SQLException {
char[] passwordCopy = password.clone();
Properties props = new Properties(); Properties props = new Properties();
props.setProperty("user", "user"); props.setProperty("user", "user");
props.put("password", password); props.put("password", passwordCopy);
try { try {
return DriverManager.getConnection(url, props); return DriverManager.getConnection(url, props);
} finally { } finally {
Arrays.fill(password, (char) 0); Arrays.fill(passwordCopy, (char) 0);
} }
} }
} }