You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2014/08/14 15:03:12 UTC

[jira] [Resolved] (CXF-5795) Reading the entity from a Response with 202 - Accepted causes NullPointerException

     [ https://issues.apache.org/jira/browse/CXF-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-5795.
-----------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 3.0.1)
                       (was: 2.7.12)
                   3.1.0
                   3.0.2
                   2.7.13

The current workaround is to use the  contextual property as shown in the the commit message. It will be set by default in 2.7.13, etc unless a client explicitly requests a one way invocation 

> 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.13, 3.0.2, 3.1.0
>
>         Attachments: cxf-demo.zip
>
>
> 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)