From 161fdf7340f1a461d936947a52ceb0de67239203 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 3 Jun 2016 14:27:05 +0200 Subject: throw writeexecption in downloader if flush fails --- .../eu/siacs/conversations/http/HttpDownloadConnection.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/main/java') 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(); -- cgit v1.2.3