Avoid filename conflicts (not sure if it will be totally fixed). Check if a chapter is properly downloaded after download finishes.

This commit is contained in:
inorichi
2015-12-04 18:03:56 +01:00
parent 260fa59799
commit c52c567eae
6 changed files with 34 additions and 37 deletions

View File

@@ -130,13 +130,13 @@ public final class DiskUtils {
try {
bufferedSink = Okio.buffer(Okio.sink(writeFile));
bufferedSink.writeAll(bufferedSource);
bufferedSink.close();
} catch (Exception e) {
writeFile.delete();
throw new IOException("Unable to save image");
} finally {
if (bufferedSink != null) {
bufferedSink.close();
}
writeFile.delete();
throw new IOException("Failed saving image");
}
return writeFile;