Hi all,
I have a custom XmlAdapter to Marshal org.joda.time.DateTime to xs
ate
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,