Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.6
-
Fix Version/s: 1.2.7
-
Component/s: Aegis Module
-
Labels:None
-
Environment:Java 5 / Java 6
-
Number of attachments :
Description
When serializing a date value of null the DateTimeType calls Calendar.setTime without null checking the date object. The Calendar then throws a NPE.
Shouldn't XFire either catch the NPE or better check against null before setting the date and serializing a null calendar instead?
My colleague Stephan Kozel did a quick fix for org.codehaus.xfire.aegis.type.basic.DateTimeType for the 1.2.6 release
— DateTimeType_xfire.java 2007-05-02 10:50:54.000000000 +0200
+++ DateTimeType_fixed.java 2007-11-27 16:45:12.000000000 +0100
@@ -47,8 +47,12 @@
public void writeObject(Object object, MessageWriter writer, MessageContext context)
{
+ if (object != null) { + Calendar c = Calendar.getInstance(); c.setTime((Date) object); writer.writeValue(format.format(c)); + }
else
{ + writer.writeXsiNil(); + }}
}