Marshalling creates empty list when Set.size()!=0
-------------------------------------------------
Key: JIBX-106
URL: http://jira.codehaus.org/browse/JIBX-106
Project: JiBX
Type: Bug
Components: core
Versions: JiBX 1.1, JiBX 1.0.1
Environment: blackdown-jdk-1.4.2.03
Reporter: Nathan Egge
Attachments: jibx-test2.tar.gz
Along the same lines as JIBX-105, I've extended my object model to look more
like my actual application. I have a situation where I'm trying to print out a
Set of Translation objects for a given parent object. When I print out the
size of the Set in a pre-get method it is not empty, however the JiBX
marshalling code creates an empty set.
Here is the binding.xml
<binding>
<mapping class="model.LocalizedText" abstract="true"
type-name="translation-list" pre-get="debug">
<collection name="translations" field="translations"
factory="model.Survey.hashSetFactory">
<structure name="translation" type="model.Translation">
<value name="text" field="text"/>
</structure>
</collection>
</mapping>
<mapping name="survey" class="model.Survey">
<value name="name" field="name"/>
<collection name="surveyBlocks" field="surveyBlocks"
factory="org.jibx.runtime.Utility.arrayListFactory">
<structure name="surveyBlock" type="model.SurveyBlock">
<value name="type" field="type"/>
<collection name="surveyPages" field="surveyPages"
factory="org.jibx.runtime.Utility.arrayListFactory">
<structure name="surveyPage" type="model.SurveyPage">
<value name="type" field="type"/>
<structure name="title" field="title" map-as="translation-list"/>
</structure>
</collection>
</structure>
</collection>
</mapping>
</binding>
Here is the output from my JUnit test:
test-module:
[echo] Testing domain...
[junit] DEBUG --- LocalizedText.debug()V(24) | id=1
[junit] DEBUG --- LocalizedText.debug()V(25) | translations.size=2
[junit] Testsuite: test.JibxTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.547 sec
[junit] ------------- Standard Output ---------------
[junit] <?xml version="1.0" encoding="UTF-8"?>
[junit] <survey>
[junit] <name>cva</name>
[junit] <surveyBlocks>
[junit] <surveyBlock>
[junit] <type>1</type>
[junit] <surveyPages>
[junit] <surveyPage>
[junit] <type>1</type>
[junit] <title>
[junit] <translations></translations>
[junit] </title>
[junit] </surveyPage>
[junit] </surveyPages>
[junit] </surveyBlock>
[junit] </surveyBlocks>
[junit] </survey>
[junit] ------------- ---------------- ---------------
I am starting to wonder if there is a serious flaw in the way that Set's are
handled.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs