[
https://issues.apache.org/jira/browse/CXF-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094086#comment-14094086
]
Philippe Larouche commented on CXF-5795:
----------------------------------------
Hi guys!
I confirm that the bug still exists in version 3.0.1. I reproduced the exact
same scenario described initialy and Here is the trace I got:
HTTP/1.1 202 Accepted
Content-Type: application/json
Date: Tue, 12 Aug 2014 14:03:43 GMT
Transfer-Encoding: chunked
Server: Jetty(8.1.15.v20140411)
body:
{"identifiantCorrelation":"ddb4b52b-797e-457a-a4f2-9c84bf7b9f20","cause":null,"identifiantTransaction":null,"messages":null,"statut":"ACCEPTE"}
I would expect the response to be casted in my specific class, but it is not.
I receive the following exception:
javax.ws.rs.ProcessingException: java.lang.IllegalStateException: The entity is
not backed by an input stream, entity class is : null
at
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:387)
at
org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:495)
at
org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1169)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1152)
at
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1089)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:883)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:417)
at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:447)
When I change the response status to SUCCESS, everything's fine. This
exception occurs with CXF version 3.0.1. If I try the version 3.0.0, I receive
the following exception insteand:
javax.ws.rs.ProcessingException: java.lang.NullPointerException
at
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:387)
at
org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:496)
at
org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1168)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1151)
at
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1088)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:882)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:853)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:417)
at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:447)
Thanks to reopen the bug and keep us posted on it.
Phil
> Reading the entity from a Response with 202 - Accepted causes
> NullPointerException
> ----------------------------------------------------------------------------------
>
> Key: CXF-5795
> URL: https://issues.apache.org/jira/browse/CXF-5795
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.11
> Environment: Apache CXF 2.7.11
> Reporter: Daniel Peder Dahlsveen
> Assignee: Sergey Beryozkin
> Fix For: 2.7.12, 3.0.1
>
>
> The entity of a Response with HTTP status code 202 - Accepted is null. This
> causes a NullPointerException when calling response.readEntity().
> Furthermore, this bug seems to only occur when using the JAXRSClientFactory,
> and it was introduced in CXF 2.7.11.
> The stacktrace is of the NullPointerException:
> java.lang.NullPointerException
> at
> org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:345)
> at
> org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:286)
> at
> org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:276)
> To recreate the bug do the following:
> Create a REST service that returns a 202 - Accepted with a non-null entity.
> In our case, the service was for HTTP POST.
> Create a unit test that tests the service by creating a client with the
> JAXRSClientFactory and then reads the entity from the response.
> Both return Response.accepted(entity).build(); and return
> Response.status(Response.Status.ACCEPTED).entity(entity).build(); causes the
> bug.
--
This message was sent by Atlassian JIRA
(v6.2#6252)