Surround more synchronization logic with try-catch, hope this makes things more resilient

pull/14/head
Tim Su 15 years ago
parent 578c9ba579
commit a8173dc7ea

@ -213,7 +213,7 @@ public abstract class SynchronizationProvider {
* @param remoteTasks remote tasks that have been updated
* @return local tasks that need to be pushed across
*/
protected void synchronizeTasks(final Context context, LinkedList<TaskProxy>
protected synchronized void synchronizeTasks(final Context context, LinkedList<TaskProxy>
remoteTasks, SynchronizeHelper helper) throws IOException {
final SyncStats stats = new SyncStats();
final StringBuilder log = new StringBuilder();
@ -284,6 +284,7 @@ public abstract class SynchronizationProvider {
// 3. UPDATE: for each updated local task
for(SyncMapping mapping : data.localChanges) {
try {
TaskProxy localTask = new TaskProxy(getId(), mapping.getRemoteId());
TaskModelForSync task = taskController.fetchTaskForSync(
mapping.getTask());
@ -294,9 +295,13 @@ public abstract class SynchronizationProvider {
localTask.readFromTaskModel(task);
localTask.readTagsFromController(task.getTaskIdentifier(),
tagController, data.tags);
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_localtx,
task.getName()));
} catch (Exception e) {
AstridUtilities.reportFlurryError("sync-read-local-task", e);
Log.e("astrid", "Exception receiving task", e);
log.append("error reading local task\n");
}
postUpdate(new ProgressUpdater(stats.remoteUpdatedTasks,
data.localChanges.size()));

Loading…
Cancel
Save