1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 07:56:19 +00:00

Fixed bug preventing that right modification time is saved in downloads

This commit is contained in:
David A. Velasco 2014-01-24 14:29:11 +01:00
parent bbc5ab97f4
commit 1370d96045

View File

@ -28,6 +28,7 @@ import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@ -60,7 +61,7 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
//private long mModificationTimestamp = 0;
private long mModificationTimestamp = 0;
private GetMethod mGet;
private String mRemotePath;
@ -131,13 +132,11 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
}
}
savedFile = true;
/*
Header modificationTime = mGet.getResponseHeader("Last-Modified");
if (modificationTime != null) {
Date d = WebdavUtils.parseResponseDate((String) modificationTime.getValue());
mModificationTimestamp = (d != null) ? d.getTime() : 0;
}
*/
} else {
client.exhaustResponse(mGet.getResponseBodyAsStream());
@ -176,4 +175,9 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
public void cancel() {
mCancellationRequested.set(true); // atomic set; there is no need of synchronizing it
}
public long getModificationTimestamp() {
return mModificationTimestamp;
}
}