Fixed crash by URL with whitespaces in login page; reviewed error handling and user...
[pub/Android/ownCloud.git] / src / eu / alefzero / webdav / WebdavClient.java
index 1e64bdf..1fabe3a 100644 (file)
@@ -255,10 +255,10 @@ public class WebdavClient extends HttpClient {
      */\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
+            WebdavClient client = new WebdavClient();\r
+            client.setCredentials(username, password);\r
+            HeadMethod head = new HeadMethod(uri.toString());\r
             returnCode = client.executeMethod(head);\r
         } catch (HttpException e) {\r
             Log.e(TAG, "HTTP exception trying to login at " + uri.getEncodedPath(), e);\r