From af28e28cd981fc8dcae2c818a573eb851eaf3026 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Sun, 5 Jan 2014 22:31:06 +0000 Subject: [PATCH] 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. --- briar-core/src/net/sf/briar/db/H2Database.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/briar-core/src/net/sf/briar/db/H2Database.java b/briar-core/src/net/sf/briar/db/H2Database.java index c3dcc64ffe..2255e8e74e 100644 --- a/briar-core/src/net/sf/briar/db/H2Database.java +++ b/briar-core/src/net/sf/briar/db/H2Database.java @@ -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"); -- GitLab