\r
package com.owncloud.android.authentication;\r
\r
- import com.owncloud.android.AccountUtils;\r
import com.owncloud.android.Log_OC;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
\r
finish();\r
\r
- } else {\r
+ } else if (result.isServerFail() || result.isException()) {\r
+ /// if server fail or exception in authorization, the UI is updated as when a server check failed\r
+ mServerIsChecked = true;\r
+ mServerIsValid = false;\r
+ mIsSslConn = false;\r
+ mOcServerChkOperation = null;\r
+ mDiscoveredVersion = null;\r
+ mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());\r
+\r
+ // update status icon and text\r
+ updateServerStatusIconAndText(result);\r
+ showServerStatus();\r
+ mAuthStatusIcon = 0;\r
+ mAuthStatusText = 0;\r
+ showAuthStatus();\r
+ \r
+ // update input controls state\r
+ showRefreshButton();\r
+ mOkButton.setEnabled(false);\r
+\r
+ // very special case (TODO: move to a common place for all the remote operations) (dangerous here?)\r
+ if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+\r
+ } else { // authorization fail due to client side - probably wrong credentials\r
updateAuthStatusIconAndText(result);\r
showAuthStatus();\r
Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
import org.apache.commons.httpclient.HttpStatus;
import org.apache.jackrabbit.webdav.DavException;
+ import android.accounts.Account;
+ import android.accounts.AccountsException;
+
import com.owncloud.android.Log_OC;
+ import com.owncloud.android.authentication.AccountUtils.AccountNotFoundException;
import com.owncloud.android.network.CertificateCombinedException;
/**
/** Generated - should be refreshed every time the class changes!! */
private static final long serialVersionUID = -7805531062432602444L;
+
private static final String TAG = "RemoteOperationResult";
LOCAL_STORAGE_NOT_MOVED,
LOCAL_STORAGE_NOT_COPIED,
OAUTH2_ERROR_ACCESS_DENIED,
- QUOTA_EXCEEDED
+ QUOTA_EXCEEDED,
+ ACCOUNT_NOT_FOUND,
+ ACCOUNT_EXCEPTION
}
private boolean mSuccess = false;
} else if (e instanceof UnknownHostException) {
mCode = ResultCode.HOST_NOT_AVAILABLE;
+ } else if (e instanceof AccountNotFoundException) {
+ mCode = ResultCode.ACCOUNT_NOT_FOUND;
+
+ } else if (e instanceof AccountsException) {
+ mCode = ResultCode.ACCOUNT_EXCEPTION;
+
} else if (e instanceof SSLException || e instanceof RuntimeException) {
CertificateCombinedException se = getCertificateCombinedException(e);
if (se != null) {
} else if (mException instanceof IOException) {
return "Unrecovered transport exception";
+ } else if (mException instanceof AccountNotFoundException) {
+ Account failedAccount = ((AccountNotFoundException)mException).getFailedAccount();
+ return mException.getMessage() + " (" + (failedAccount != null ? failedAccount.name : "NULL") + ")";
+
+ } else if (mException instanceof AccountsException) {
+ return "Exception while using account";
+
} else {
return "Unexpected exception";
}
}
+ public boolean isServerFail() {
+ return (mHttpCode >= HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public boolean isException() {
+ return (mException != null);
+ }
+
}