andymc12 commented on a change in pull request #851:
URL: https://github.com/apache/cxf/pull/851#discussion_r710708460



##########
File path: 
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
##########
@@ -418,7 +418,7 @@ private Link makeAbsoluteLink(Link link) {
 
     public <T> T doReadEntity(Class<T> cls, Type t, Annotation[] anns)
         throws ProcessingException, IllegalStateException {
-        return doReadEntity(cls, t, anns, false);
+        return doReadEntity(cls, t, anns, 
!InputStream.class.isAssignableFrom(cls));

Review comment:
       Hmm... My take on this is that the user should be closing their 
`Response` objects (which are `AutoCloseable` making it easier to do so).  
Despite my comment to the contrary, the `readEntity` methods are not supposed 
to close the `Response` - they are supposed to close the underlying entity 
stream.  Maybe we could fix this by always closing the entity stream in the 
finally block?
   
   FWIW, RESTEasy uses a `finalize()` method on their `Response` implementation 
class that will close the response once garbage collected as a safety net.  
That might also work here. Wdyt?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to