What does my set method need to look like if I have a field with type='bytes'?

For example:

public class Foo
{
        private byte[] _bytes;
        
        public byte[] getBytes()
        {
                return _bytes;
        }

        public void setBytes(byte[] bytes)
        {
                _bytes = bytes;
        }
}

mapping.xml
<mapping>
        <class name="Foo">
            <field name="bytes" type="bytes"/>
        </class>
</mapping>

This chokes with the following:
java.lang.IllegalArgumentException: argument type mismatch
        at java.lang.reflect.Array.set(Native Method)
        at org.exolab.castor.mapping.loader.J1CollectionHandlers$1.add(Unknown Source)
        at org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(Unknown Source)
        at org.exolab.castor.xml.UnmarshalHandler.endElement(Unknown Source)
        at 
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:552)
        at 
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646)
        at 
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2978)
        at 
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:918)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1145)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:988)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
        at 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
        at 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
        at 
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source)

...

Thanks in advance!!!
        --m

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to