mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Prevent that connection manager cleans up response buffer of failed downloads
This commit is contained in:
parent
67e5ccd4af
commit
d7a707293d
@ -82,8 +82,7 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
|
|||||||
/// perform the download
|
/// perform the download
|
||||||
try {
|
try {
|
||||||
tmpFile.getParentFile().mkdirs();
|
tmpFile.getParentFile().mkdirs();
|
||||||
int status = downloadFile(client, tmpFile);
|
result = downloadFile(client, tmpFile);
|
||||||
result = new RemoteOperationResult(isSuccess(status), mGet);
|
|
||||||
Log_OC.i(TAG, "Download of " + mRemotePath + " to " + getTmpPath() + ": " +
|
Log_OC.i(TAG, "Download of " + mRemotePath + " to " + getTmpPath() + ": " +
|
||||||
result.getLogMessage());
|
result.getLogMessage());
|
||||||
|
|
||||||
@ -97,8 +96,10 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected int downloadFile(OwnCloudClient client, File targetFile) throws HttpException,
|
private RemoteOperationResult downloadFile(OwnCloudClient client, File targetFile) throws
|
||||||
IOException, OperationCancelledException {
|
IOException, OperationCancelledException {
|
||||||
|
|
||||||
|
RemoteOperationResult result;
|
||||||
int status = -1;
|
int status = -1;
|
||||||
boolean savedFile = false;
|
boolean savedFile = false;
|
||||||
mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
|
mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
|
||||||
@ -162,7 +163,10 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
|
|||||||
|
|
||||||
} else if (status != 403){
|
} else if (status != 403){
|
||||||
client.exhaustResponse(mGet.getResponseBodyAsStream());
|
client.exhaustResponse(mGet.getResponseBodyAsStream());
|
||||||
}
|
|
||||||
|
} // else, body read by RemoteOeprationResult constructor
|
||||||
|
|
||||||
|
result = new RemoteOperationResult(isSuccess(status), mGet);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (fos != null) fos.close();
|
if (fos != null) fos.close();
|
||||||
@ -171,7 +175,7 @@ public class DownloadRemoteFileOperation extends RemoteOperation {
|
|||||||
}
|
}
|
||||||
mGet.releaseConnection(); // let the connection available for other methods
|
mGet.releaseConnection(); // let the connection available for other methods
|
||||||
}
|
}
|
||||||
return status;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSuccess(int status) {
|
private boolean isSuccess(int status) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user