Improve exception handling in HttpDownloadHelper
This commit is contained in:
parent
d670575d74
commit
b622fd18a2
|
@ -332,13 +332,14 @@ public class HttpDownloadHelper {
|
|||
}
|
||||
finished = !isInterrupted();
|
||||
} finally {
|
||||
IOUtils.close(os, is);
|
||||
|
||||
// we have started to (over)write dest, but failed.
|
||||
// Try to delete the garbage we'd otherwise leave
|
||||
// behind.
|
||||
if (!finished) {
|
||||
// we have started to (over)write dest, but failed.
|
||||
// Try to delete the garbage we'd otherwise leave
|
||||
// behind.
|
||||
IOUtils.closeWhileHandlingException(os, is);
|
||||
dest.delete();
|
||||
} else {
|
||||
IOUtils.close(os, is);
|
||||
}
|
||||
}
|
||||
progress.endDownload();
|
||||
|
|
Loading…
Reference in New Issue