diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-03 14:27:05 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-06-03 14:27:05 +0200 |
commit | 161fdf7340f1a461d936947a52ceb0de67239203 (patch) | |
tree | fe2cfb4350ca5c431e47c56484160b139e45a89e /src/main | |
parent | e402348f9b24853f08f323fe6208bbd42d6ced49 (diff) |
throw writeexecption in downloader if flush fails
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index cffed30a..a28bb679 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -304,16 +304,14 @@ public class HttpDownloadConnection implements Transferable { throw new CancellationException(); } } + try { + os.flush(); + } catch (IOException e) { + throw new WriteException(); + } } catch (CancellationException | IOException e) { throw e; } finally { - if (os != null) { - try { - os.flush(); - } catch (final IOException ignored) { - - } - } FileBackend.close(os); FileBackend.close(is); wakeLock.release(); |