1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-15 10:22:53 +00:00

Minor improvements for upload cancelation and conflicts in synchronization

This commit is contained in:
David A. Velasco
2015-07-21 16:50:48 +02:00
parent 5985ba9a9f
commit 8bf276377c
5 changed files with 14 additions and 9 deletions
@@ -54,7 +54,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
}
@Override
protected int uploadFile(OwnCloudClient client) throws HttpException, IOException {
protected int uploadFile(OwnCloudClient client) throws IOException {
int status = -1;
FileChannel channel = null;
@@ -140,6 +140,9 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
if (transferred == totalToTransfer) { // Check if the file is completed
savedFile = true;
Header modificationTime = mGet.getResponseHeader("Last-Modified");
if (modificationTime == null) {
modificationTime = mGet.getResponseHeader("last-modified");
}
if (modificationTime != null) {
Date d = WebdavUtils.parseResponseDate((String) modificationTime.getValue());
mModificationTimestamp = (d != null) ? d.getTime() : 0;
@@ -102,8 +102,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
(mPutMethod != null ? mPutMethod.getResponseHeaders() : null));
}
} catch (Exception e) {
// TODO something cleaner with cancellations
if (mCancellationRequested.get()) {
if (mCancellationRequested.get() && !(e instanceof OperationCancelledException)) {
result = new RemoteOperationResult(new OperationCancelledException());
} else {
result = new RemoteOperationResult(e);
@@ -117,8 +116,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
status == HttpStatus.SC_NO_CONTENT));
}
protected int uploadFile(OwnCloudClient client) throws HttpException, IOException,
OperationCancelledException {
protected int uploadFile(OwnCloudClient client) throws IOException {
int status = -1;
try {
File f = new File(mLocalPath);