I  am trying to unmarshal an object part of which is a date.  This date is
not always set in the DB,
so at times it could be null.  When Castor tries to unmarshal it when it is
null, I get a NullPointerException 
and then 

java.lang.NullPointerException
        at
org.exolab.castor.xml.handlers.DateFieldHandler.setValue(DateFieldHandler.ja
va:189)
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:780)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.jav
a:552)
        at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXML
DocumentParser.java:217)
        at
org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.ja
va:594)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java
:817)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDo
cumentFragmentScannerImpl.java:748)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(XMLDocumentFragmentScannerImpl.java:1454)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocume
ntFragmentScannerImpl.java:333)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
nfiguration.java:529)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
nfiguration.java:585)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:114
8)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:555)
>>>---- End Exception ----<<< 

My object declares a property 
(using java.util.Date)

private Date ExpireDate;

And my mapping file looks like:

<field name="ExpireDate" type="java.util.Date" direct="false">
        <bind-xml name="ExpireDate" node="element"/>
</field>

Can anyone give me their thoughts of whether it should be able to handle a
null value,
or a way for me to handle it myself.

Thanks

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

Reply via email to