- syncResult.stats.numIoExceptions++;\r
- e.printStackTrace();\r
- } catch (Throwable t) {\r
- // TODO update syncResult\r
- Log.e(TAG, "problem while synchronizing owncloud account " + account.name, t);\r
- t.printStackTrace();\r
+ syncResult.stats.numParseExceptions++;\r
+ logException(e, uri + "/");\r
+ \r
+ } catch (Exception e) {\r
+ // TODO something smart with syncresult\r
+ logException(e, uri + "/");\r
+ mRightSync = false;\r
+ \r
+ } finally {\r
+ if (query != null)\r
+ query.releaseConnection(); // let the connection available for other methods\r
+ mRightSync &= (syncResult.stats.numIoExceptions == 0 && syncResult.stats.numAuthExceptions == 0 && syncResult.stats.numParseExceptions == 0);\r
+ if (!mRightSync && mIsManualSync) {\r
+ /// don't let the system synchronization manager retries MANUAL synchronizations\r
+ // (be careful: "MANUAL" currently includes the synchronization requested when a new account is created and when the user changes the current account)\r
+ syncResult.tooManyRetries = true;\r
+ \r
+ /// notify the user about the failure of MANUAL synchronization\r
+ Notification notification = new Notification(R.drawable.icon, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());\r
+ notification.flags |= Notification.FLAG_AUTO_CANCEL;\r
+ // TODO put something smart in the contentIntent below\r
+ notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);\r
+ notification.setLatestEventInfo(getContext().getApplicationContext(), \r
+ getContext().getString(R.string.sync_fail_ticker), \r
+ String.format(getContext().getString(R.string.sync_fail_content), account.name), \r
+ notification.contentIntent);\r
+ ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_fail_ticker, notification);\r
+ }\r
+ sendStickyBroadcast(false, null); // message to signal the end to the UI\r