[
http://jira.codehaus.org/browse/JIBX-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Sosnoski closed JIBX-122.
--------------------------------
> The get-method used in the collection element seems to be used
> inappropriately during unmarshalling.
> ----------------------------------------------------------------------------------------------------
>
> Key: JIBX-122
> URL: http://jira.codehaus.org/browse/JIBX-122
> Project: JiBX
> Issue Type: Improvement
> Components: core
> Affects Versions: JiBX 1.1
> Reporter: Edwin Free
> Assignee: Dennis Sosnoski
> Priority: Minor
> Fix For: JiBX 1.1.5
>
>
> I've defined a mapping in my binding like this:
> <mapping name="Application" class="Application">
> <collection name="MandatoryComponents" create-type="java.util.ArrayList"
> item-type="ComponentInstance" get-method="getMandatoryComponentInstances"
> set-method="addMandatoryComponentInstances"/>
> </mapping>
> I noticed in the bytecode enhanced Application class, the generated
> unmarshalling method becomes:
> public final Application JiBX_application_unmarshal_1_1(UnmarshallingContext
> arg1)
> throws JiBXException
> {
> arg1.pushTrackedObject(this);
> this;
> arg1.parsePastStartTag(null, "MandatoryComponents");
> Collection collection;
>
> addMandatoryComponentInstances(JiBX_MungeAdapter.JiBX_application_unmarshal_1_0((collection
> = getMandatoryComponentInstances()) != null ? collection :
> JiBX_MungeAdapter.JiBX_application_newinstance_1_0(arg1), arg1));
> arg1.parsePastCurrentEndTag(null, "MandatoryComponents");
> arg1.popObject();
> return this;
> }
> It turns out that the my method getMandatoryComponentInstances(), I am
> returning an unmodifiable Collection. I do not return null if the collection
> is empty. When I run my unmarshalling testcase, I will get an
> UnsupportedOperationException because you cannot add to the collection my
> method returns.
> It seems to me it would be wrong to assume my get-method will return
> something you can add to. Furthermore, why is the get-method being used for
> unmarshalling? I already specified a create-type="java.util.ArrayList", so
> why not just instantiate one of those?
--
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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs