Change your mapping.xml file as follows:
from:
<field name="values" type="strings" direct="true">
<bind-xml name="values" node="element"/>
</field>
to:
<field name="values" type="string" collection="array" direct="true">
<bind-xml name="values" node="element"/>
</field>
I am not sure why "strings" isn't be flagged as an invalid type. But if
you change your mapping, it will work properly as I just ran your test
case here.
--Keith
Matthew Mower wrote:
>
> Hi.
>
> I'm not having any luck getting Castor 0.9.3.9 to unmarshall a String[] that
> is has previously marshalled. I always get the following exception:
>
> >>>--- Begin Exception ---<<<
> java.lang.IllegalArgumentException: Type conversion error: could not set
> value of values(java.lang.String) with value of type java.lang.String
> at
> org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(FieldHandlerImpl.j
> ava:460)
> at
> org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:478)
> at
> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
> at
> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.
> java:1436)
> at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XML
> DocumentScanner.java:1205)
> at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.j
> ava:381)
> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
> at marunmart.<init>(marunmart.java:39)
> at marunmart.main(marunmart.java:50)
> >>>---- End Exception ----<<<
>
> at
> org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:508)
> at
> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
> at
> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.
> java:1436)
> at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XML
> DocumentScanner.java:1205)
> at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.j
> ava:381)
> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
> at marunmart.<init>(marunmart.java:39)
> at marunmart.main(marunmart.java:50)
> Exception in thread "main"
>
> I've attached a simple test case. Am I doing something wrong? It seems to
> work if I switch to using a Vector instead.
>
> Regards,
>
> matt.
>
> ---
> We must be the change we wish to see - M. K. Gandhi
>
> ------------------------------------------------------------------------
> Name: elem.java
> elem.java Type: VisualCafe File
>(application/x-unknown-content-type-VisualCafeFile.Document)
> Encoding: base64
> Description: elem.java
>
> Name: marunmart.java
> marunmart.java Type: VisualCafe File
>(application/x-unknown-content-type-VisualCafeFile.Document)
> Encoding: base64
> Description: marunmart.java
>
> Name: mapping.xml
> mapping.xml Type: XML Document (text/xml)
> Encoding: base64
> Description: mapping.xml
>
> Name: error.txt
> error.txt Type: Plain Text (text/plain)
> Encoding: base64
> Description: error.txt
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev