From 07e64d8deddad56f763b32ddac17333f3229420a Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 30 Jun 2013 22:11:50 -0700 Subject: Flush BufferedOutputStream correctly This ensures that IOException due to writes are thrown in the main code path instead of the exceptional code path. Specifically for HttpDownloader this ensures that IOUtils.closeQuietly does not swallow a failed write. --- tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/src/de/danoeh/antennapod/test') diff --git a/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java b/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java index 132d40eba..daba95dbf 100644 --- a/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java +++ b/tests/src/de/danoeh/antennapod/test/FeedHandlerTest.java @@ -54,7 +54,7 @@ public class FeedHandlerTest extends AndroidTestCase { for (int i = 0; i < num_retries; i++) { InputStream in = null; - OutputStream out = null; + BufferedOutputStream out = null; try { in = getInputStream(feed.getDownload_url()); assertNotNull(in); @@ -65,6 +65,7 @@ public class FeedHandlerTest extends AndroidTestCase { while ((count = in.read(buffer)) != -1) { out.write(buffer, 0, count); } + out.flush(); successful = true; } catch (IOException e) { e.printStackTrace(); -- cgit v1.2.3