You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2022/01/19 02:12:00 UTC

[jira] [Comment Edited] (CXF-8642) ResponseImpl#hasEntity changed behaviour starting with cxf 3.4.1

    [ https://issues.apache.org/jira/browse/CXF-8642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17478294#comment-17478294 ] 

Andriy Redko edited comment on CXF-8642 at 1/19/22, 2:11 AM:
-------------------------------------------------------------

Thank you for reporting it, [~cowclaw] , the regression was introduced while implementing TCK compliant behavior: the `hasEntity()` now ensures that the entity stream is not empty. However in your case, the entity stream is not empty but is fully consumed with an exception and the `hasEntity()` mistaken this fact with the empty stream.


was (Author: reta):
Thank you for reporting it, [~cowclaw] , the regression was introduced while implementing TCK compliant behavior: the `hasEntity()` now ensures that the entity stream is not empty. However in your case, the entity stream is not empty but is fully consumed and the `hasEntity()` mistaken this fact with the empty stream.

> ResponseImpl#hasEntity changed behaviour starting with cxf 3.4.1
> ----------------------------------------------------------------
>
>                 Key: CXF-8642
>                 URL: https://issues.apache.org/jira/browse/CXF-8642
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.5.0, 3.4.1, 3.4.5
>            Reporter: Florian Kamella
>            Assignee: Andriy Redko
>            Priority: Major
>              Labels: response
>             Fix For: 3.4.6, 3.5.1, 4.0.0
>
>
> Starting with version cxf version 3.4.1 Response.hasEntitiy() does return false after a call to Response.readEntity() threw an exception, even when Response.bufferEntity() was called before. 
> Response response = // obtain response with an entity from service call
> response.bufferEntity()
> response.hasEntity() // true
> response.readEntity(SomeWrongEntityClass.class) // throws an exception
> response.hasEntity() //false
> I created a github repository with ready-to-run sample code to show the issue https://github.com/cowclaw/cxf-regression
> Simply clone the repository and run ./gradlew build to see it in action.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)