[ 
http://jira.codehaus.org/browse/XFIRE-982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_115049
 ] 

Siegfried Goeschl commented on XFIRE-982:
-----------------------------------------

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)
     {
-        Calendar c = Calendar.getInstance();
+       if (object != null) {
+       Calendar c = Calendar.getInstance();
         c.setTime((Date) object);
         writer.writeValue(format.format(c));
+      } else {
+       writer.writeXsiNil();
+      }
     }
 }

> DateTimeType does not handle null date well
> -------------------------------------------
>
>                 Key: XFIRE-982
>                 URL: http://jira.codehaus.org/browse/XFIRE-982
>             Project: XFire
>          Issue Type: Bug
>          Components: Aegis Module
>    Affects Versions: 1.2.6
>         Environment: Java 5 / Java 6
>            Reporter: Markus Wolf
>            Assignee: Dan Diephouse
>             Fix For: 1.2.7
>
>         Attachments: unified_diff_DateTimeTypeFix.txt
>
>
> 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?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to