IllegalArgumentException is better than DbException in case of bug #3.

If the app restarts after crashing and tries to return to the activity
where it crashed, DatabaseConfig's encryption key will be null and no DB
operations can be performed. It's better to crash again in that case
than for all DB operations to fail.

Fixing bug #3 will make this irrelevant.
This commit is contained in:
akwizgran
2014-01-05 22:31:06 +00:00
parent e8b89f251f
commit af28e28cd9

View File

@@ -79,7 +79,7 @@ class H2Database extends JdbcDatabase {
protected Connection createConnection() throws SQLException {
byte[] key = config.getEncryptionKey();
if(key == null) return null;
if(key == null) throw new IllegalStateException();
char[] password = encodePassword(key);
Properties props = new Properties();
props.setProperty("user", "user");