You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2022/01/19 02:27:17 UTC

[GitHub] [cxf] reta commented on a change in pull request #893: CXF-8642: ResponseImpl#hasEntity return 'false' when entity is buffered but entity stream is fully consumed with processing exception

reta commented on a change in pull request #893:
URL: https://github.com/apache/cxf/pull/893#discussion_r787300871



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
##########
@@ -152,6 +152,9 @@ public boolean hasEntity() {
         Object actualEntity = getActualEntity();
         if (actualEntity == null) {
             return false;
+        } else if (entityBufferred) {

Review comment:
       When exception occurs while reading entity, it could happen that:
    -  getActualEntity() return `entity` (since `lastEntity` is `null`)
    - but the `entity` 's `InputStream` is fully consumed and is not empty
    - however, reading over fully consumed stream in this case is equivalent to reading over empty stream: nothing left to read
   
   As such, the `hasEntity` return `false`. Adding the short circuit logic to make sure that if entity was buffered successfully, the response is considered to have an entity.




-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org