X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/8aa08be8706131a60f3a249c4ac9d326d4dfde53..cc39a76a90e6ecd572dbb249faae4e00b115832f:/src/com/owncloud/android/operations/RemoteOperation.java diff --git a/src/com/owncloud/android/operations/RemoteOperation.java b/src/com/owncloud/android/operations/RemoteOperation.java index 9306e350..6e674c46 100644 --- a/src/com/owncloud/android/operations/RemoteOperation.java +++ b/src/com/owncloud/android/operations/RemoteOperation.java @@ -21,11 +21,12 @@ import java.io.IOException; import org.apache.commons.httpclient.Credentials; import com.owncloud.android.Log_OC; -import com.owncloud.android.authentication.AccountAuthenticator; +import com.owncloud.android.MainApp; import com.owncloud.android.network.BearerCredentials; import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.operations.RemoteOperationResult.ResultCode; + import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountsException; @@ -136,14 +137,8 @@ public abstract class RemoteOperation implements Runnable { mCallerActivity = callerActivity; mClient = null; // the client instance will be created from mAccount and mContext in the runnerThread to create below - if (listener == null) { - throw new IllegalArgumentException("Trying to execute a remote operation asynchronously without a listener to notiy the result"); - } mListener = listener; - if (listenerHandler == null) { - throw new IllegalArgumentException("Trying to execute a remote operation asynchronously without a handler to the listener's thread"); - } mListenerHandler = listenerHandler; Thread runnerThread = new Thread(this); @@ -243,7 +238,8 @@ public abstract class RemoteOperation implements Runnable { repeat = false; if (mCallerActivity != null && mAccount != null && mContext != null && !result.isSuccess() && - (result.getCode() == ResultCode.UNAUTHORIZED || (result.isTemporalRedirection() && result.isIdPRedirection()))) { +// (result.getCode() == ResultCode.UNAUTHORIZED || (result.isTemporalRedirection() && result.isIdPRedirection()))) { + (result.getCode() == ResultCode.UNAUTHORIZED || result.isIdPRedirection())) { /// possible fail due to lack of authorization in an operation performed in foreground Credentials cred = mClient.getCredentials(); String ssoSessionCookie = mClient.getSsoSessionCookie(); @@ -253,9 +249,9 @@ public abstract class RemoteOperation implements Runnable { boolean bearerAuthorization = (cred != null && cred instanceof BearerCredentials); boolean samlBasedSsoAuthorization = (cred == null && ssoSessionCookie != null); if (bearerAuthorization) { - am.invalidateAuthToken(AccountAuthenticator.ACCOUNT_TYPE, ((BearerCredentials)cred).getAccessToken()); + am.invalidateAuthToken(MainApp.getAccountType(), ((BearerCredentials)cred).getAccessToken()); } else if (samlBasedSsoAuthorization ) { - am.invalidateAuthToken(AccountAuthenticator.ACCOUNT_TYPE, ssoSessionCookie); + am.invalidateAuthToken(MainApp.getAccountType(), ssoSessionCookie); } else { am.clearPassword(mAccount); }