[ 
https://issues.apache.org/jira/browse/CXF-2916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016819#comment-13016819
 ] 

Sergey Beryozkin commented on CXF-2916:
---------------------------------------

Andrew, your patch has been applied to Jettison 1.3-SNAPSHOT trunk, thanks.

Just FYI, JAXB, as opposed to Aegis, reports an empty string instead of null.

I suspect this is because Jettison now reports START and END element events but 
does not report CHARACTERS if 'currentValue' is null so JAXB assumes it is the 
case of something like <id></id>, thus, when we have 'String id', it sets the 
value of it to "".

I reckon that Jettison may need to enhanced a bit more to deal with properly, 
that is, if currentValue is null, then, rather than reporting START_ELEMENT, it 
has to completely skip the current node, but only if it is a simple element, 
possibly calling processElement() instead of setting an event to START_ELEMENT.

However, I'm not too worried if that not get fixed right now, empty value is 
definitely better than "null" and as you can see Aegis defaults to "" in case 
of null.

Please also check JSONProvider.testReadListOfDerivedTypesWithNullField  




> unmarshalling the JSON of a subclass fails when a field value is null
> ---------------------------------------------------------------------
>
>                 Key: CXF-2916
>                 URL: https://issues.apache.org/jira/browse/CXF-2916
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.9
>         Environment: Windows XP,  JDK 1.6.0_14
>            Reporter: Chaitanya Choleti
>         Attachments: CXF-2916-jettison.patch, CXF-2916.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Unmarshalling the JSON :
> {"@xsi.type" : "subClassTest", "id" : "10000000", "name" : null }
> should give an instance of SubClassTest.class and the value of the field 
> name(which is a String) should be null, but with the current implementation 
> the value of the field name is String "null" .
> This happens only in the case of unmarshalling JSON to a subclass.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to