From: <rb...@us...> - 2016-11-07 18:01:13
|
Revision: 13063 http://sourceforge.net/p/htmlunit/code/13063 Author: rbri Date: 2016-11-07 18:01:00 +0000 (Mon, 07 Nov 2016) Log Message: ----------- do not hide io exceptions Issue 1832 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2016-10-28 13:30:46 UTC (rev 13062) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2016-11-07 18:01:00 UTC (rev 13063) @@ -19,6 +19,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.EOFException; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -718,8 +719,9 @@ * @param is the stream to read * @param maxInMemory the maximumBytes to store in memory, after which save to a local file * @return a wrapper around the downloaded content + * @throws IOException in case of read issues */ - public static DownloadedContent downloadContent(final InputStream is, final int maxInMemory) { + public static DownloadedContent downloadContent(final InputStream is, final int maxInMemory) throws IOException { if (is == null) { return new DownloadedContent.InMemory(new byte[] {}); } @@ -746,9 +748,9 @@ LOG.warn("Connection was closed while reading from stream.", e); return new DownloadedContent.InMemory(bos.toByteArray()); } - catch (final IOException e) { + catch (final EOFException e) { // this might happen with broken gzip content - LOG.warn("Exception while reading from stream.", e); + LOG.warn("EOFException while reading from stream.", e); return new DownloadedContent.InMemory(bos.toByteArray()); } finally { |