Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: JiBX 1.1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:I am using JiBX with JDK 1.4 on Windows XP with Eclipse in an JBOSS environment.
-
Number of attachments :
Description
I defined my own unmarshaller to translate code-elments like <code>DE</code> into existing objects read from my database. The problem occurs when i try to unmarshall a collection of such objects:
Binding:
<collection set-method="setNationalities" item-type="customizing.Country" factory="io.XMLBindingUtils.factorySet">
<structure name="citizenship">
<structure name="code" type="customizing.Country"
unmarshaller="io.CustomizingDataUnmarshaller"/>
</structure>
</collection>
XML-file snipet:
<citizenship>
<code>US</code>
</citizenship>
<citizenship>
<code>DE</code>
</citizenship>
This code should create a Set of Country objects and call setNationalities to store the set in my object.
However setNationaties is always called with an empty Set. If remove the tag <citizenship> from XML-file and from the binding it works (see below) ! Note, that my unmarshaller works correctly. It finds and returns Country-Objects as expected but the add-method of the Set is called with an java.lang.object instead of a customizing.Country object.
Binding:
<collection set-method="setNationalities" item-type="customizing.Country" factory="io.XMLBindingUtils.factorySet">
<structure name="code" type="customizing.Country"
unmarshaller="io.CustomizingDataUnmarshaller"/>
</collection>
XML-file snipet:
<code>US</code>
<code>DE</code>
This seems to be a bug. I hope you can tell me a workaround. Is there any other way to ignore the citizenship tag ?
This is a bug, but I'm considering it a minor one since you can easily change your unmarshaller code to handle the <citizenship> wrapper element as well as the <code> element. Considering that there's a workaround, I probably won't fix this until the 2.0 rewrite of the code generation.