Removed commented code and remaining forced exception
authorDavid A. Velasco <dvelasco@solidgear.es>
Mon, 7 Apr 2014 09:14:44 +0000 (11:14 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Mon, 7 Apr 2014 09:14:44 +0000 (11:14 +0200)
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/services/OperationsService.java

index fe50f37..6011193 100644 (file)
@@ -307,7 +307,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
         /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)\r
         boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input); \r
 \r
         /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)\r
         boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input); \r
-        //boolean refreshButtonEnabled = false;\r
         if (savedInstanceState == null) {\r
             if (mAccount != null) {\r
                 mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);\r
         if (savedInstanceState == null) {\r
             if (mAccount != null) {\r
                 mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);\r
@@ -321,7 +320,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
             }\r
         } else {\r
                 mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
             }\r
         } else {\r
-            //refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);\r
             mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);\r
             mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);\r
             \r
             mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);\r
             mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);\r
             \r
@@ -761,10 +759,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
 \r
     private void showViewPasswordButton() {\r
 \r
 \r
     private void showViewPasswordButton() {\r
-        //int drawable = android.R.drawable.ic_menu_view;\r
         int drawable = R.drawable.ic_view;\r
         if (isPasswordVisible()) {\r
         int drawable = R.drawable.ic_view;\r
         if (isPasswordVisible()) {\r
-            //drawable = android.R.drawable.ic_secure;\r
             drawable = R.drawable.ic_hide;\r
         }\r
         mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0);\r
             drawable = R.drawable.ic_hide;\r
         }\r
         mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0);\r
@@ -881,14 +877,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         showAuthStatus();\r
 \r
         // GET AUTHORIZATION request\r
         showAuthStatus();\r
 \r
         // GET AUTHORIZATION request\r
-        //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));\r
         Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim());\r
         Uri.Builder uriBuilder = uri.buildUpon();\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri));   \r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));\r
         Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim());\r
         Uri.Builder uriBuilder = uri.buildUpon();\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri));   \r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));\r
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));\r
-        //uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);\r
         uri = uriBuilder.build();\r
         Log_OC.d(TAG, "Starting browser to view " + uri.toString());\r
         Intent i = new Intent(Intent.ACTION_VIEW, uri);\r
         uri = uriBuilder.build();\r
         Log_OC.d(TAG, "Starting browser to view " + uri.toString());\r
         Intent i = new Intent(Intent.ACTION_VIEW, uri);\r
@@ -988,7 +982,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 
-        //if (result.isTemporalRedirection() && result.isIdPRedirection()) {\r
         if (result.isIdPRedirection()) {
             String url = result.getRedirectedLocation();\r
             String targetUrl = mServerInfo.mBaseUrl \r
         if (result.isIdPRedirection()) {
             String url = result.getRedirectedLocation();\r
             String targetUrl = mServerInfo.mBaseUrl \r
@@ -1329,7 +1322,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 \r
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 \r
-        result = new RemoteOperationResult(new RuntimeException("FAKE"));\r
         if (result.isSuccess()) {\r
             Log_OC.d(TAG, "Successful access - time to save the account");\r
 \r
         if (result.isSuccess()) {\r
             Log_OC.d(TAG, "Successful access - time to save the account");\r
 \r
@@ -1351,12 +1343,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             /// the server\r
             mServerIsChecked = true;\r
             mServerIsValid = false;\r
             /// the server\r
             mServerIsChecked = true;\r
             mServerIsValid = false;\r
-            /*\r
-            mServerInfo.mIsSslConn = false;\r
-            mServerInfo.mVersion = null;\r
-            mServerInfo.mBaseUrl = \r
-                    normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn);    // TODO remove?\r
-                    */\r
             mServerInfo = new GetServerInfoOperation.ServerInfo();  \r
 \r
             // update status icon and text\r
             mServerInfo = new GetServerInfoOperation.ServerInfo();  \r
 \r
             // update status icon and text\r
index bbecf21..83c950b 100644 (file)
@@ -100,12 +100,12 @@ public class OperationsService extends Service {
     private static class Target {
         public Uri mServerUrl = null;
         public Account mAccount = null;
     private static class Target {
         public Uri mServerUrl = null;
         public Account mAccount = null;
-        public String mWebDavUrl = "";
-        public String mUsername = "";
-        public String mPassword = "";
-        public String mAuthToken = "";
+        public String mWebDavUrl = null;
+        public String mUsername = null;
+        public String mPassword = null;
+        public String mAuthToken = null;
         public boolean mFollowRedirects = true;
         public boolean mFollowRedirects = true;
-        public String mCookie = "";
+        public String mCookie = null;
         
         public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
                 boolean followRedirects, String cookie) {
         
         public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
                 boolean followRedirects, String cookie) {
@@ -284,12 +284,12 @@ public class OperationsService extends Service {
                     target = new Target(
                             account, 
                             (serverUrl == null) ? null : Uri.parse(serverUrl),
                     target = new Target(
                             account, 
                             (serverUrl == null) ? null : Uri.parse(serverUrl),
-                            ((webDavPath == null) || (serverUrl == null)) ? "" : webDavUrl,
-                            (username == null) ? "" : username,
-                            (password == null) ? "" : password,
-                            (authToken == null) ? "" : authToken,
+                            ((webDavPath == null) || (serverUrl == null)) ? null : webDavUrl,
+                            username,
+                            password,
+                            authToken,
                             followRedirects,
                             followRedirects,
-                            (cookie == null) ? "" : cookie
+                            cookie
                     );
                     
                     String action = operationIntent.getAction();
                     );
                     
                     String action = operationIntent.getAction();
@@ -420,14 +420,14 @@ public class OperationsService extends Service {
                     } else {
                         mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), 
                                 mLastTarget.mFollowRedirects);    // this is not good enough
                     } else {
                         mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), 
                                 mLastTarget.mFollowRedirects);    // this is not good enough
-                        if (mLastTarget.mWebDavUrl != "") {
+                        if (mLastTarget.mWebDavUrl != null) {
                             mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
                         }
                             mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
                         }
-                        if (mLastTarget.mUsername != "" && mLastTarget.mPassword != "") {
+                        if (mLastTarget.mUsername != null && mLastTarget.mPassword != null) {
                             mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword);
                             mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword);
-                        } else if (mLastTarget.mAuthToken != "") {
+                        } else if (mLastTarget.mAuthToken != null) {
                             mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken);
                             mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken);
-                        } else if (mLastTarget.mCookie != "") {
+                        } else if (mLastTarget.mCookie != null) {
                             mOwnCloudClient.setSsoSessionCookie(mLastTarget.mCookie);
                         }
                         mStorageManager = null;
                             mOwnCloudClient.setSsoSessionCookie(mLastTarget.mCookie);
                         }
                         mStorageManager = null;