[ 
https://jira.codehaus.org/browse/JIBX-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=283590#comment-283590
 ] 

Klaus Claszen commented on JIBX-449:
------------------------------------

Hi Dennis,

your 
[email|http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/msg04744.html]
 gave me hope that you would change the behaviour back. I just checked it with 
the current 1.2.4-SNAPSHOT - it is still the same as in 1.2.3. Would be very 
gald to see a change in final 1.2.4 release.

Thanks
  Klaus

> change in collection behavior (null references) between JIBX version 1.2.3 
> and JIBX version 1.2.2
> -------------------------------------------------------------------------------------------------
>
>                 Key: JIBX-449
>                 URL: https://jira.codehaus.org/browse/JIBX-449
>             Project: JiBX
>          Issue Type: Bug
>          Components: BindGen, core
>    Affects Versions: JiBX 1.2.3
>            Reporter: Klaus Claszen
>         Attachments: jibx-collection-test.zip
>
>
> We noticed a really significant change in collection behavior between JIBX 
> version 1.2.3 and JIBX version 1.2.2.
> As documented in the collection element documentation 
> (http://jibx.sourceforge.net/binding/collection-element.html) unmarshalling 
> an optional collection behaves like this: "If an element name is used with an 
> optional collection, and that name is missing from an input XML document, the 
> collection property will be set to null." Thus (we expect and noticed in the 
> past) if no element name is used the collection property will not be set to 
> null (but will be an empty collection).
> With version 1.2.3 the collection property will be set to null, even if NO 
> element name in the binding.xml is used on the optional collection.
> To reproduce the changed behavior I provide a simple maven project using JIBX 
> 1.2.3 with the following schema:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
>                 xmlns:tns="http://foo.bar";
>                 elementFormDefault="qualified" 
>                 targetNamespace="http://foo.bar";>
>                 
>                 <xs:element name="myCollection" type="tns:myCollection"/>
>                 
>                 <xs:complexType name="myCollection">
>                                <xs:sequence>
>                                                <xs:element type="xs:string" 
> name="name" />
>                                                <xs:element type="xs:boolean" 
> name="active" />
>                                                <xs:element type="xs:int" 
> name="item" minOccurs="0" maxOccurs="unbounded" />
>                                </xs:sequence>
>                 </xs:complexType>
>                 
> </xs:schema>
> The maven project will generate the XML mapping sources (MyCollection.java) 
> and a binding.xml file. There is a simple test 
> bar.foo.JibxUnmarshallingTest.testUnmarshalXmlWithMissingListItems()
> which will unmarshal an XML with no items for a list member and the result is 
> that the object member list is null (test fails).
> If you change the jibx version in the pom.xml to 1.2.2 (and do some minor 
> code changes in the test classes because getter and setter method names of 
> generated code also changed from 1.2.2 (getItems()) to 1.2.3 (getItemList()) 
> the list member of the unmarshalled object will be an empty list (test 
> success)?.
> This issue breaks our code as we do not expect to get any null reference when 
> requesting a list of an unmarshalled object.
> (There is a Wish Issue JIBX-418 on this topic - but I think it is a 
> significant bug).

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

        

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to