Convert accessRootFolderRemoteOperation method in AsyncTask
[pub/Android/ownCloud.git] / src / com / owncloud / android / services / OperationsService.java
index 581a686..ded5edc 100644 (file)
@@ -435,13 +435,12 @@ public class OperationsService extends Service {
                 mCurrentOperation = next.second;
                 RemoteOperationResult result = null;
                 try {
+                    OwnCloudAccount ocAccount;
                     /// prepare client object to send the request to the ownCloud server
                     if (mLastTarget == null || !mLastTarget.equals(next.first)) {
                         mLastTarget = next.first;
                         if (mLastTarget.mAccount != null) {
-                            OwnCloudAccount ocAccount = new OwnCloudAccount(mLastTarget.mAccount, mService);
-                            mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                    getClientFor(ocAccount, mService);
+                            ocAccount = new OwnCloudAccount(mLastTarget.mAccount, mService);
                             mStorageManager = new FileDataStorageManager(
                                     mLastTarget.mAccount, 
                                     mService.getContentResolver()
@@ -464,12 +463,12 @@ public class OperationsService extends Service {
                                 credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials(
                                         mLastTarget.mCookie); // SAML SSO
                             }
-                            OwnCloudAccount ocAccount = new OwnCloudAccount(
+                            ocAccount = new OwnCloudAccount(
                                     mLastTarget.mServerUrl, credentials);
-                            mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                    getClientFor(ocAccount, mService);
                             mStorageManager = null;
                         }
+                        mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                                getClientFor(ocAccount, mService);
                     }
 
                     /// perform the operation