Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Commit

Permalink
Modified AbstractResource.fill to handle compressed error stream too
Browse files Browse the repository at this point in the history
Added check to exception handler in AbstractResource.fill to handle a
compressed error stream.
  • Loading branch information
jdmullin authored and peet committed Jul 21, 2015
1 parent a0e7a69 commit f807571
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/us/monoid/web/AbstractResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ void fill(URLConnection anUrlConnection) throws IOException {
// so that keep alive can keep doing its work
if (anUrlConnection instanceof HttpURLConnection) {
HttpURLConnection conn = (HttpURLConnection) anUrlConnection;
InputStream es = new BufferedInputStream(conn.getErrorStream());
InputStream es;
if ("gzip".equals(conn.getContentEncoding())) {
es = new BufferedInputStream(new GZIPInputStream(conn.getErrorStream()));
}
else {
es = new BufferedInputStream(conn.getErrorStream());
}

ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
Expand Down

0 comments on commit f807571

Please sign in to comment.