X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/cb175f29949dbac17a3870a71ecff60df5c9bdc4..83ad608faadfcfc5a0ceee9d6c460702b3ff3f11:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index ef8bda45..d6ade1ab 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -370,7 +370,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe upload = mPendingUploads.remove(buildRemoteName(account, file)); } if (upload != null) { - mCurrentUpload.cancel(); + upload.cancel(); } } @@ -389,17 +389,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe } } // Cancel pending uploads - Iterator it = mPendingUploads.keySet().iterator(); - Log_OC.d(TAG, "Number of pending uploads= " + mPendingUploads.size()); - while (it.hasNext()) { - String key = it.next(); - Log_OC.d(TAG, "mPendingUploads CANCELLED " + key); - if (key.startsWith(account.name)) { - synchronized (mPendingUploads) { - mPendingUploads.remove(key); - } - } - } + cancelUploadForAccount(account.name); } public void clearListeners() { @@ -479,7 +469,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe /** * Review uploads and cancel it if its account doesn't exist */ - public void reviewUploads() { + public void checkAccountOfCurrentUpload() { if (mCurrentUpload != null && !AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) { mCurrentUpload.cancel(); @@ -538,7 +528,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe // Detect if the account exists if (AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) { - Log_OC.d(TAG, "Account " + mCurrentUpload.getAccount().toString() + " exists"); + Log_OC.d(TAG, "Account " + mCurrentUpload.getAccount().name + " exists"); notifyUploadStart(mCurrentUpload); @@ -557,7 +547,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe /// check the existence of the parent folder for the file to upload String remoteParentPath = new File(mCurrentUpload.getRemotePath()).getParent(); - remoteParentPath = remoteParentPath.endsWith(OCFile.PATH_SEPARATOR) ? remoteParentPath : remoteParentPath + OCFile.PATH_SEPARATOR; + remoteParentPath = remoteParentPath.endsWith(OCFile.PATH_SEPARATOR) ? + remoteParentPath : remoteParentPath + OCFile.PATH_SEPARATOR; grantResult = grantFolderExistence(remoteParentPath); /// perform the upload