Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 0.9.6
-
Fix Version/s: None
-
Component/s: XML
-
Labels:None
-
Environment:Operating System: MacOS X
Platform: Macintosh
-
Bugzilla Id:1888
-
Number of attachments :
Description
Here is an example mapping document fragment:
<class name="AnyClass">
<map-to xml="test">
<field name="urlOne" type="java.lang.String">
<bind-xml name="url" />
</field>
<field name="urlTwo" type="java.lang.String">
<bind-xml name="url" location="two"/>
</field>
</class>
and a sample input file:
<test>
<url>first URL</url>
<two>
<url>second URL</url>
</two>
</test>
This causes:
unable to add 'url' to <test> due to the following exception:
>>>--- Begin Exception ---<<<
java.lang.IllegalArgumentException: Type conversion error: could not set value of
docUrl(java.lang.String) with value of type java.lang.String
at org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(FieldHandlerImpl.java:499)
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1016)
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1084)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unk
nown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
at com.dcxms.gmsmodel.CastorTest.main(CastorTest.java:32)
>>>---- End Exception ----<<<
Note that I can play with different XML/mapping file combinations:
<test>
<one>
<url>...</url>
</one>
<two>
<url>...</url>
</two>
</test>
This fails too.
Same problem exists in 0.9.5.4.
Thanks for the report Peter. I'll set this for 0.9.7 as an indication the it
should be made available in a bug fix release.