From 784070c27c71e992acff4f69bd53cc97aa9fcbcb Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 27 Mar 2017 16:08:45 +0100 Subject: [PATCH] SyncManager: add remote entries to cache only after they've been processed Before this change we were adding them to cache before they were processed, potentially persisting malformed entries, or entries we haven't yet processed causing issues if sync was aborted before an entry was fully processed. --- .../java/com/etesync/syncadapter/syncadapter/SyncManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java index 8a8da1e7..e9b87de7 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java @@ -298,10 +298,11 @@ abstract public class SyncManager { App.log.info("Processing (" + String.valueOf(i) + "/" + strTotal + ") " + entry.toString()); SyncEntry cEntry = SyncEntry.fromJournalEntry(settings.password(), entry); - persistSyncEntry(entry.getUuid(), cEntry); App.log.info("Processing resource for journal entry"); processSyncEntry(cEntry); + persistSyncEntry(entry.getUuid(), cEntry); + remoteCTag = entry.getUuid(); } } finally {