+ \r
+ /**\r
+ * Logs an exception triggered in a synchronization request. \r
+ * \r
+ * @param e Caught exception.\r
+ * @param uri Uri to the remote directory that was fetched when the synchronization failed \r
+ */\r
+ private void logException(Exception e, String uri) {\r
+ if (e instanceof IOException) {\r
+ Log.e(TAG, "Unrecovered transport exception while synchronizing " + uri + " at " + getAccount().name, e);\r
+\r
+ } else if (e instanceof DavException) {\r
+ Log.e(TAG, "Unexpected WebDAV exception while synchronizing " + uri + " at " + getAccount().name, e);\r
+\r
+ } else {\r
+ Log.e(TAG, "Unexpected exception while synchronizing " + uri + " at " + getAccount().name, e);\r
+ }\r
+ }\r
+\r
+ private void updateOCVersion() {\r
+ String statUrl = getAccountManager().getUserData(getAccount(), AccountAuthenticator.KEY_OC_BASE_URL);\r
+ statUrl += AccountUtils.STATUS_PATH;\r
+ \r
+ try {\r
+ String result = getClient().getResultAsString(statUrl);\r
+ if (result != null) {\r
+ try {\r
+ JSONObject json = new JSONObject(result);\r
+ if (json != null && json.getString("version") != null) {\r
+ OwnCloudVersion ocver = new OwnCloudVersion(json.getString("version"));\r
+ if (ocver.isVersionValid()) {\r
+ getAccountManager().setUserData(getAccount(), AccountAuthenticator.KEY_OC_VERSION, ocver.toString());\r
+ Log.d(TAG, "Got new OC version " + ocver.toString());\r
+ } else {\r
+ Log.w(TAG, "Invalid version number received from server: " + json.getString("version"));\r
+ }\r
+ }\r
+ } catch (Throwable e) {\r
+ Log.w(TAG, "Couldn't parse version response", e);\r
+ }\r
+ } else {\r
+ Log.w(TAG, "Problem while getting ocversion from server");\r
+ }\r
+ } catch (Exception e) {\r
+ Log.e(TAG, "Problem getting response from server", e);\r
+ }\r
+ }\r