From 0251f0e41695d3961dde553ba9ab76fa46583abb Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Wed, 19 Aug 2015 01:13:12 +0530 Subject: introduced constants for keyserver sync, fixed sync issue --- .../keychain/provider/ProviderHelper.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index e8eea6831..cbb71276c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -700,20 +700,14 @@ public class ProviderHelper { new String[]{"" + masterKeyId}, null ); - ContentValues lastUpdatedEntry = null; if (lastUpdatedCursor.moveToNext()) { - lastUpdatedEntry = new ContentValues(2); + // there was an entry to re-insert + // this operation must happen after the new key is inserted + ContentValues lastUpdatedEntry = new ContentValues(2); lastUpdatedEntry.put(UpdatedKeys.MASTER_KEY_ID, lastUpdatedCursor.getLong(INDEX_MASTER_KEY_ID)); lastUpdatedEntry.put(UpdatedKeys.LAST_UPDATED, lastUpdatedCursor.getLong(INDEX_LAST_UPDATED)); - Log.e("PHILIP", "cv: " + lastUpdatedEntry + " actual: " + masterKeyId); - } - lastUpdatedCursor.close(); - - if (lastUpdatedEntry != null) { - // there was an entry to re-insert - // this operation must happen after the new key is inserted operations.add( ContentProviderOperation .newInsert(UpdatedKeys.CONTENT_URI) @@ -721,6 +715,7 @@ public class ProviderHelper { .build() ); } + lastUpdatedCursor.close(); try { // delete old version of this keyRing, which also deletes all keys and userIds on cascade -- cgit v1.2.3