Hi,
Can you please help with this one ?
-------- Original Message --------
Subject: Re: Fwd: JAXB:Invalid boolean values added to lists as 'false'
Date: Fri, 26 Aug 2011 14:04:45 +0530
From: jviswana <jviswana_at_linux.vnet.ibm.com>
Reply-To: dev_at_jaxb.java.net
To: martin.grebac_at_oracle.com
CC: dev_at_jaxb.java.net
Hi Martin ,
Thanks for your response !
I would like to understand here a little better on what lines of spec,
the code is behaving as Null in case of integer and false in case of
Boolean .
If you go by Section 5.5.2 of the spec,
*The base type of an indexed property may be either a primitive type or
a reference type, while that of a list property must be a reference type. *
The values in collections are represented as Object References and not
primitives .
As per Section 3.8.4 of the spec,
*3. a reference (must be mapped to a simple type) - value is null. *
Even if we don't consider the above 2 portions of the spec, even then we
are not seeing a consistent behavior between Integer Vs Boolean since "
"Integer is having null value while Boolean does not" as per the test
results . Either Integer should as well behave like its primitive
counter part having 0 for uninitialized values
I believe this has to be changed on either case .
Please let me know your thoughts . I have created a work-item
http://java.net/jira/browse/JAXB-849 and attached the code-diffs .
Regards,
Jayashree V
On 12/08/2011 14:31, Martin Grebac wrote:
> Hi,
> the behaviour now currently matches as defined in spec, so I don't
> think I want to change it at this point. I may be able to add some
> switch to be able to revert to the older behaviour. If that would
> help, file an issue please,
> MartiNG
>
> On 08/09/2011 10:13 AM, jviswana wrote:
>> Hi ,
>>
>> Can you please help with this one ?
>>
>> -------- Original Message --------
>> Subject: JAXB:Invalid boolean values added to lists as 'false'
>> Date: Thu, 28 Jul 2011 17:15:04 +0530
>> From: jviswana <jviswana_at_linux.vnet.ibm.com>
>> Reply-To: dev_at_jaxb.java.net
>> To: dev_at_jaxb.java.net
>>
>>
>>
>> Hi,
>>
>> Sun bug number 6975714 , had a fix which further had broken some
>> scenarios which used to work . When a JAXB class has a list property and
>> the instance document contains invalid values for those elements, each
>> of those invalid values is represented in the list with null. The JAXB
>> RI is now writing false to the list for Boolean, while all other types
>> (integers, longs, doubles, etc...) consistently write null.
>>
>> Current Results:
>> Test(1) bools: [false, false, true, false]
>> Test(2) ints: [null, null, 17, null]
>>
>> Previous Results: [Before the bug fix in 2.2.1 ]
>> Test(1) bools: [null, null, true, null]
>> Test(2) ints: [null, null, 17, null]
>>
>> I think the behavior should be like 2.2.1 where null was stored for
>> invalid Boolean , like other types.
>>
>> Regards,
>> Jayashree Viswanathan
>>
>>
>>
>>
>>
>
> --
> Martin Grebac, GlassFish/Metro/JAXB/Tooling at Oracle
> http://blogs.sun.com/mgrebac
> ICQ: 93478885