Announcement Announcement Module
Collapse
No announcement yet.
JAXB nullpointer when marshalling a null date value Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JAXB nullpointer when marshalling a null date value

    Hi all,

    I have a custom XmlAdapter to Marshal org.joda.time.DateTime to xsate

    Code:
    public String marshal(YearMonthDay v) {
    		if (v.getYearMonthDay() != null) {
    			return v.getYearMonthDay()
    					.toString(DateTimeFormat.forPattern("YYYY-MM-dd"));
    		} else {
    			return null;
    		}
    	}
    When I return a null value (if the value is null) I will receive a nullpointer in JAXB:

    Code:
    Caused by: java.lang.NullPointerException
    	at com.sun.xml.internal.bind.v2.runtime.output.SAXOutput.text(SAXOutput.java:114)
    So my question is: Is it illegal to return null here? If so how to deal with null values?

    Thanks in advance.

    Regards,

  • #2
    JAXB issue

    Seems to be an issue in JAXB: https://jaxb.dev.java.net/issues/show_bug.cgi?id=415

    Comment

    Working...
    X