You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Reinis Vicups (JIRA)" <ji...@apache.org> on 2012/11/02 01:14:12 UTC

[jira] [Created] (TOMEE-514) JSONProvider - default setting of serializeAsArray is true, leading to marshaling error in out-of-the-box CXF configuration

Reinis Vicups created TOMEE-514:
-----------------------------------

             Summary: JSONProvider - default setting of serializeAsArray is true, leading to marshaling error in out-of-the-box CXF configuration
                 Key: TOMEE-514
                 URL: https://issues.apache.org/jira/browse/TOMEE-514
             Project: TomEE
          Issue Type: Improvement
    Affects Versions: 1.5.1
            Reporter: Reinis Vicups


Referring to this thread: http://openejb.979440.n4.nabble.com/Possible-JSON-bug-in-TomEE-1-5-and-1-5-1-td4658328.html it appears that the default setting of serializeAsArray is set to true for the standard CXF JSONParser.

This appears to lead to the situation where even the root-objet of the marshaled object tree is formatted as an array. The CXF Unmarshaler (not sure which class is doing this exactly) fails if root object is formatted as an array (I have experienced this error in the case where my root object was NOT a collection).

Example:

class MyObject {
 String id;
}

is marshaled as (square braces '[' indicate an array):

{"myobjectinstance:[{"id":"12345}]}

and the webmethod "receiving" the MyObject that is formatted with the square braces will fail:

@Consumes("application/json")
@POST
@Path("/process")
public MyObject process(MyObject myObjectInstance) {
...
}

So solution could be
- to set serializeAsArray to false or
- somehow in other way ensure that single instances in json are formatted as such,
- or make standard CXF json unmarshaler more tolerant with single instances formatted as an array.

br
Reinis

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (TOMEE-514) JSONProvider - default setting of serializeAsArray is true, leading to marshaling error in out-of-the-box CXF configuration

Posted by "Romain Manni-Bucau (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TOMEE-514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Romain Manni-Bucau closed TOMEE-514.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.1

commited (rev 1405046)
                
> JSONProvider - default setting of serializeAsArray is true, leading to marshaling error in out-of-the-box CXF configuration
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMEE-514
>                 URL: https://issues.apache.org/jira/browse/TOMEE-514
>             Project: TomEE
>          Issue Type: Improvement
>    Affects Versions: 1.5.1
>            Reporter: Reinis Vicups
>              Labels: cxf, json
>             Fix For: 1.5.1
>
>
> Referring to this thread: http://openejb.979440.n4.nabble.com/Possible-JSON-bug-in-TomEE-1-5-and-1-5-1-td4658328.html it appears that the default setting of serializeAsArray is set to true for the standard CXF JSONParser.
> This appears to lead to the situation where even the root-objet of the marshaled object tree is formatted as an array. The CXF Unmarshaler (not sure which class is doing this exactly) fails if root object is formatted as an array (I have experienced this error in the case where my root object was NOT a collection).
> Example:
> class MyObject {
>  String id;
> }
> is marshaled as (square braces '[' indicate an array):
> {"myobjectinstance:[{"id":"12345}]}
> and the webmethod "receiving" the MyObject that is formatted with the square braces will fail:
> @Consumes("application/json")
> @POST
> @Path("/process")
> public MyObject process(MyObject myObjectInstance) {
> ...
> }
> So solution could be
> - to set serializeAsArray to false or
> - somehow in other way ensure that single instances in json are formatted as such,
> - or make standard CXF json unmarshaler more tolerant with single instances formatted as an array.
> br
> Reinis

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira