- } catch (HttpException e) {\r
- Log.e(TAG, "HTTP exception uploading " + localFile + " to " + remoteTarget, e);\r
-\r
- } catch (IOException e) {\r
- Log.e(TAG, "I/O exception uploading " + localFile + " to " + remoteTarget, e);\r
-\r
- } catch (Exception e) {\r
- Log.e(TAG, "Unexpected exception uploading " + localFile + " to " + remoteTarget, e);\r
- }\r
- \r
- if (!result && status >= 0) Log.e(TAG, "Upload of " + localFile + " to " + remoteTarget + " FAILED with HTTP status " + status);\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Tries to log in to the given WedDavURI, with the given credentials\r
- * @param uri To test\r
- * @param username Username to check\r
- * @param password Password to verify\r
- * @return A {@link HttpStatus}-Code of the result. SC_OK is good.\r
- */\r
- public static int tryToLogin(Uri uri, String username, String password) {\r
- int returnCode = 0;\r
- WebdavClient client = new WebdavClient();\r
- client.setCredentials(username, password);\r
- HeadMethod head = new HeadMethod(uri.toString());\r
- try {\r
- returnCode = client.executeMethod(head);\r
- } catch (HttpException e) {\r
- Log.e(TAG, "HTTP exception trying to login at " + uri.getEncodedPath(), e);\r
- } catch (IOException e) {\r
- Log.e(TAG, "I/O exception trying to login at " + uri.getEncodedPath(), e);\r
- } catch (Exception e) {\r
- Log.e(TAG, "Unexpected exception trying to login at " + uri.getEncodedPath(), e);\r