X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2275f2eca4a223618194bf4f6b5b41f50d4b1d36..01fc29c892bf5d1cb7dc1f8094d91a1a6a96a6bf:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 61375c43..06760e85 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -344,10 +344,11 @@ public class SynchronizeFolderOperation extends SyncOperation { /// classify file to sync/download contents later if (remoteFile.isFolder()) { /// to download children files recursively - startSyncFolderOperation(remoteFile.getRemotePath()); - - if (mCancellationRequested.get()) { - throw new OperationCancelledException(); + synchronized(mCancellationRequested) { + if (mCancellationRequested.get()) { + throw new OperationCancelledException(); + } + startSyncFolderOperation(remoteFile.getRemotePath()); } } else if (remoteFile.keepInSync()) { @@ -389,9 +390,11 @@ public class SynchronizeFolderOperation extends SyncOperation { /// classify file to sync/download contents later if (child.isFolder()) { /// to download children files recursively - startSyncFolderOperation(child.getRemotePath()); - if (mCancellationRequested.get()) { - throw new OperationCancelledException(); + synchronized(mCancellationRequested) { + if (mCancellationRequested.get()) { + throw new OperationCancelledException(); + } + startSyncFolderOperation(child.getRemotePath()); } } else { @@ -413,13 +416,15 @@ public class SynchronizeFolderOperation extends SyncOperation { private void startDirectDownloads() throws OperationCancelledException { for (OCFile file : mFilesForDirectDownload) { - if (mCancellationRequested.get()) { - throw new OperationCancelledException(); + synchronized(mCancellationRequested) { + if (mCancellationRequested.get()) { + throw new OperationCancelledException(); + } + Intent i = new Intent(mContext, FileDownloader.class); + i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); + i.putExtra(FileDownloader.EXTRA_FILE, file); + mContext.startService(i); } - Intent i = new Intent(mContext, FileDownloader.class); - i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); - i.putExtra(FileDownloader.EXTRA_FILE, file); - mContext.startService(i); } } @@ -435,7 +440,8 @@ public class SynchronizeFolderOperation extends SyncOperation { */ private void startContentSynchronizations(List filesToSyncContents, OwnCloudClient client) throws OperationCancelledException { - + + Log_OC.v(TAG, "Starting content synchronization... "); RemoteOperationResult contentsResult = null; for (SyncOperation op: filesToSyncContents) { if (mCancellationRequested.get()) { @@ -520,4 +526,8 @@ public class SynchronizeFolderOperation extends SyncOperation { intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, path); mContext.startService(intent); } + + public String getRemotePath() { + return mRemotePath; + } }