-
Bug
-
Resolution: Done
-
Critical
-
2.3.1
-
None
-
None
The GZIPDecodingInterceptor was patched as a part of RESTEASY-554. However the fix introduced a new bug. The input stream is being closed before being passed to the method implementing a service. Consider the following code.
@POST @Path("/data/upload") @GZIP @Consumes("application/xml") public Response uploadData(final InputStream inputStream) { String content = IOUtils.toString(inputStream, CloudSystemInformation.getDefaultCharset().toString()); }
The result is NPE.
java.lang.NullPointerException: Inflater has been closed at java.util.zip.Inflater.ensureOpen(Inflater.java:364) at java.util.zip.Inflater.inflate(Inflater.java:237) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:135) at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:92) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.Reader.read(Reader.java:123) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1485) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1461) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1436) at org.apache.commons.io.IOUtils.toString(IOUtils.java:585)