X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/246c25d27ed398217404fa1781f7f9421027975e..b5d70ad8e793f27324aeb3af6597dd51a3a051ee:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 03f65854..0c735401 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -70,6 +70,7 @@ import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientList import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; import com.owncloud.android.lib.common.accounts.AccountTypeUtils; +import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; import com.owncloud.android.lib.common.network.CertificateCombinedException; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; @@ -1000,8 +1001,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity showAuthStatus(); Log_OC.d(TAG, result.getLogMessage()); } else { - updateAccountAuthentication(); - success = true; + try { + updateAccountAuthentication(); + success = true; + + } catch (AccountNotFoundException e) { + Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); + Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); + finish(); + } } } @@ -1367,8 +1375,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity success = createAccount(); } else { - updateAccountAuthentication(); - success = true; + try { + updateAccountAuthentication(); + success = true; + + } catch (AccountNotFoundException e) { + Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); + Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); + finish(); + } } if (success) { @@ -1417,16 +1432,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity * Kills the session kept by OwnCloudClientManager so that a new one will created with * the new credentials when needed. */ - private void updateAccountAuthentication() { - - try { - OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor( - new OwnCloudAccount(mAccount, this) // TODO avoid this creation may block the main thread - ); - } catch (Exception e) { - e.printStackTrace(); - } + private void updateAccountAuthentication() throws AccountNotFoundException { + OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor( + new OwnCloudAccount(mAccount, this) + ); Bundle response = new Bundle(); response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);