[ https://issues.apache.org/jira/browse/CXF-8726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17556490#comment-17556490 ]
Konrad Windszus commented on CXF-8726: -------------------------------------- The difference with retries is that the response's entity is an {{java.io.SequenceInputStream}} with two input streams: # {{org.apache.cxf.helpers.LoadingByteArrayOutputStream$LoadedByteArrayInputStream}} (containing the actual response body) and # {{sun.net.www.protocol.http.HttpURLConnection$HttpInputStream}} while in case of no retries, a {{java.io.SequenceInputStream}} containing only the first stream is returned. The subsequent {{com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider}} can only deal with the latter, but not with the former (i.e. returns null). > org.apache.cxf.jaxrs.client.ResponseExceptionMapper cannot evaluate response > body in case of retries > ---------------------------------------------------------------------------------------------------- > > Key: CXF-8726 > URL: https://issues.apache.org/jira/browse/CXF-8726 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.4.4 > Reporter: Konrad Windszus > Priority: Major > > I have registered a custom > {{org.apache.cxf.jaxrs.client.ResponseExceptionMapper}}. In case the request > is retried (in my case via a {{org.apache.cxf.clustering.FailoverFeature}} > leveraging a {{RetryStrategy}}), the custom response exception mapper gets > {{null}} as return value for {{response.readEntity(Class)}} in its > {{fromResponse(Response response}} method as it seems this one can not/no > longer access the response body. > IMHO javax.ws.rs.core.Response.readEntity(...) must never return null but > rather throw an exception (compare with its javadoc at > https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/Response.html#readEntity-java.lang.Class-). -- This message was sent by Atlassian Jira (v8.20.7#820007)