DatabaseBackend bugfixes

Don't leak cursors, initially create tables
This commit is contained in:
Andreas Straub 2015-06-29 13:40:56 +02:00
parent 299bbdf27f
commit 9e07fc5651
1 changed files with 5 additions and 0 deletions

View File

@ -123,6 +123,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON DELETE CASCADE);"); + ") ON DELETE CASCADE);");
db.execSQL(CREATE_CONTATCS_STATEMENT); db.execSQL(CREATE_CONTATCS_STATEMENT);
db.execSQL(CREATE_SESSIONS_STATEMENT);
db.execSQL(CREATE_PREKEYS_STATEMENT);
db.execSQL(CREATE_SIGNED_PREKEYS_STATEMENT);
} }
@Override @Override
@ -563,6 +566,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
try { try {
session = new SessionRecord(Base64.decode(cursor.getString(cursor.getColumnIndex(AxolotlService.SQLiteAxolotlStore.KEY)),Base64.DEFAULT)); session = new SessionRecord(Base64.decode(cursor.getString(cursor.getColumnIndex(AxolotlService.SQLiteAxolotlStore.KEY)),Base64.DEFAULT));
} catch (IOException e) { } catch (IOException e) {
cursor.close();
throw new AssertionError(e); throw new AssertionError(e);
} }
} }
@ -751,6 +755,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
} catch (IOException ignored) { } catch (IOException ignored) {
} }
} }
cursor.close();
return prekeys; return prekeys;
} }