You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2017/07/02 11:11:00 UTC

[jira] [Updated] (MEECROWAVE-49) Returning a binary leads to nullpointers

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

Romain Manni-Bucau updated MEECROWAVE-49:
-----------------------------------------
    Description: 
Currently Meecrowave tries to serve too much mime types via Johnzon. This leads to ugly NullPointerExceptions.

Given the following REST endpoints:

{code:java}
    @GET
    @Path("test4")
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public Response testOctetStream() { ...}
{code}

or 

{code:java}
    @GET
    @Path("test5")
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public byte[] testOctetStream() { ...}
{code}

We currently blow up with a NPE:
{noformat}
Caused by: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
	at org.apache.johnzon.jsonb.JohnsonJsonb.toJson(JohnsonJsonb.java:313) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
	at org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider.writeTo(JsonbJaxrsProvider.java:152) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1386) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:244) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
{noformat}

  was:
Currently Meecrowave tries to serve ALL mime types via Johnzon. This leads to ugly NullPointerExceptions.

Given the following REST endpoints:

{code:java}
    @GET
    @Path("test4")
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public Response testOctetStream() { ...}
{code}

or 

{code:java}
    @GET
    @Path("test5")
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public byte[] testOctetStream() { ...}
{code}

We currently blow up with a NPE:
{noformat}
Caused by: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
	at org.apache.johnzon.jsonb.JohnsonJsonb.toJson(JohnsonJsonb.java:313) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
	at org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider.writeTo(JsonbJaxrsProvider.java:152) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1386) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:244) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
{noformat}


> Returning a binary leads to nullpointers
> ----------------------------------------
>
>                 Key: MEECROWAVE-49
>                 URL: https://issues.apache.org/jira/browse/MEECROWAVE-49
>             Project: Meecrowave
>          Issue Type: Bug
>    Affects Versions: 0.3.1
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 0.4.0
>
>
> Currently Meecrowave tries to serve too much mime types via Johnzon. This leads to ugly NullPointerExceptions.
> Given the following REST endpoints:
> {code:java}
>     @GET
>     @Path("test4")
>     @Produces(MediaType.APPLICATION_OCTET_STREAM)
>     public Response testOctetStream() { ...}
> {code}
> or 
> {code:java}
>     @GET
>     @Path("test5")
>     @Produces(MediaType.APPLICATION_OCTET_STREAM)
>     public byte[] testOctetStream() { ...}
> {code}
> We currently blow up with a NPE:
> {noformat}
> Caused by: java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
> 	at org.apache.johnzon.jsonb.JohnsonJsonb.toJson(JohnsonJsonb.java:313) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
> 	at org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider.writeTo(JsonbJaxrsProvider.java:152) ~[johnzon-jsonb-1.1.1.jar:1.1.1]
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1386) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:244) ~[cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)