aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/persistance
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-12-12 19:40:56 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-12-12 19:40:56 +0100
commitb9247bc3a795d60bfb1504bef47877250807f0d4 (patch)
tree58826acb26d3690b9c9042a05ef573b012b3f3b4 /src/main/java/de/pixart/messenger/persistance
parent6c3565392a46f7bf203ed5ea1eed5f7b05c9a78f (diff)
don’t use secure delete when migrating edit column
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index 76cbd6cf2..9738bb8b3 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -193,7 +193,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
@Override
public void onConfigure(SQLiteDatabase db) {
db.execSQL("PRAGMA foreign_keys=ON");
- db.rawQuery("PRAGMA secure_delete=ON", null);
+ db.rawQuery("PRAGMA secure_delete=ON", null).close();
}
@Override
@@ -574,7 +574,12 @@ public class DatabaseBackend extends SQLiteOpenHelper {
}
if (oldVersion < 50 && newVersion >= 50) {
+ final long start = SystemClock.elapsedRealtime();
+ db.rawQuery("PRAGMA secure_delete = FALSE", null).close();
db.execSQL("update " + Message.TABLENAME + " set " + Message.EDITED + "=NULL");
+ db.rawQuery("PRAGMA secure_delete=ON", null).close();
+ final long diff = SystemClock.elapsedRealtime() - start;
+ Log.d(Config.LOGTAG, "deleted old edit information in " + diff + "ms");
}
}
@@ -624,14 +629,14 @@ public class DatabaseBackend extends SQLiteOpenHelper {
String newJid;
try {
newJid = Jid.of(cursor.getString(cursor.getColumnIndex(Contact.JID))).toString();
- } catch (IllegalArgumentException ignored) {
+ } catch (final IllegalArgumentException e) {
Log.e(Config.LOGTAG, "Failed to migrate Contact JID "
+ cursor.getString(cursor.getColumnIndex(Contact.JID))
- + ": " + ignored + ". Skipping...");
+ + ": Skipping...", e);
continue;
}
- String[] updateArgs = {
+ final String[] updateArgs = {
newJid,
cursor.getString(cursor.getColumnIndex(Contact.ACCOUNT)),
cursor.getString(cursor.getColumnIndex(Contact.JID)),