Refresh authorization token on failed synchronizations when notification error is...
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / RemoteOperation.java
index 79e53a9..06a70f7 100644 (file)
@@ -244,6 +244,7 @@ public abstract class RemoteOperation implements Runnable {
         
             repeat = false;
             if (mCallerActivity != null && mAccount != null && mContext != null && !result.isSuccess() && result.getCode() == ResultCode.UNAUTHORIZED) {
+                /// fail due to lack of authorization in an operation performed in foreground
                 AccountManager am = AccountManager.get(mContext);
                 Credentials cred = mClient.getCredentials();
                 if (cred instanceof BearerCredentials) {
@@ -252,7 +253,8 @@ public abstract class RemoteOperation implements Runnable {
                     am.clearPassword(mAccount);
                 }
                 mClient = null;
-                repeat = true;
+                repeat = true;  // when repeated, the creation of a new OwnCloudClient after erasing the saved credentials will trigger the login activity
+                result = null;
             }
         } while (repeat);