Merge pull request #957 from owncloud/fix_crash_invalid_server_url
authorDavid A. Velasco <dvelasco@owncloud.com>
Wed, 22 Apr 2015 09:01:52 +0000 (11:01 +0200)
committerDavid A. Velasco <dvelasco@owncloud.com>
Wed, 22 Apr 2015 09:01:52 +0000 (11:01 +0200)
Fix crash when typed invalid URL

1  2 
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@@ -380,7 -380,7 +380,7 @@@ public class AuthenticatorActivity exte
              findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);\r
              mRefreshButton = findViewById(R.id.centeredRefreshButton);\r
          }\r
-         showRefreshButton(mServerIsChecked && !mServerIsValid && \r
+         showRefreshButton(mServerIsChecked && !mServerIsValid &&\r
                  mWaitingForOpId > Integer.MAX_VALUE);\r
          mServerStatusView = (TextView) findViewById(R.id.server_status_text);\r
          showServerStatus();\r
          mOkButton.setEnabled(false);\r
          mServerInfo = new GetServerInfoOperation.ServerInfo();\r
          showRefreshButton(false);\r
-         \r
\r
          if (uri.length() != 0) {\r
              // Handle internationalized domain names\r
              uri = DisplayUtils.convertIdn(uri, true);\r
\r
              mServerStatusText = R.string.auth_testing_connection;\r
              mServerStatusIcon = R.drawable.progress_small;\r
              showServerStatus();\r
  \r
      // TODO remove, if possible\r
      private String trimUrlWebdav(String url){       \r
 -        if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0)){\r
 -            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0.length());             \r
 -        } else if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_2_0)){\r
 -            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_2_0.length());             \r
 -        } else if (url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_1_2)){\r
 -            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_1_2.length());             \r
 -        } \r
 +        if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)){\r
 +            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());\r
 +        }\r
          return (url != null ? url : "");\r
      }\r
  \r
                  );\r
              }\r
  \r
 +            // include account version with the new account\r
 +            mAccountMgr.setUserData(\r
 +                mAccount,\r
 +                Constants.KEY_OC_ACCOUNT_VERSION,\r
 +                Integer.toString(AccountUtils.ACCOUNT_VERSION)\r
 +            );\r
 +\r
              /// add the new account as default in preferences, if there is none already\r
              Account defaultAccount = AccountUtils.getCurrentOwnCloudAccount(this);\r
              if (defaultAccount == null) {\r