From: David A. Velasco Date: Tue, 24 Feb 2015 14:02:26 +0000 (+0100) Subject: Grant that the proper RemoteOperationResult is built when an upload is cancelled... X-Git-Tag: oc-android-1.7.1_signed^2~40^2~2^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/4d2b38278559761828e67cba0e87448be1c2901e?ds=inline;hp=--cc Grant that the proper RemoteOperationResult is built when an upload is cancelled while copying to temporary space --- 4d2b38278559761828e67cba0e87448be1c2901e diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index 7d51a4ad..3c7917e8 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -258,7 +258,6 @@ public class UploadFileOperation extends RemoteOperation { (nRead = in.read(data, 0, data.length)) != -1) { out.write(data, 0, nRead); } - out.flush(); } else { @@ -278,6 +277,11 @@ public class UploadFileOperation extends RemoteOperation { } } + if (mCancellationRequested.get()) { + result = new RemoteOperationResult(new OperationCancelledException()); + } + + } catch (Exception e) { result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED); return result; @@ -300,7 +304,7 @@ public class UploadFileOperation extends RemoteOperation { } } } - localCopyPassed = true; + localCopyPassed = result.isSuccess(); /// perform the upload if ( mChunked &&