axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joachim Björklund <joac...@bizlink.se>
Subject BeanDeser... and java.sql.Date
Date Thu, 26 Sep 2002 06:03:08 GMT
Hi, when having fields of java.sql.Date in your bean, and when deserializing
from "xsd:dateTime" (internally interpeted as java.util.Calendar) by the
default BeanDeserializer. It will not work.

When Axis tries to set the value in the bean it will fail as the field is
not of type Calendar. Well, Axis then tries to convert the Calendar-value
using the org.apache.axis.utils.JavaUtils class, but the class only handles
java.util.Date's and not java.sql.Date's.

I would suggest to add this functionallity to JavaUtils (if there's not a
good reason to why it's not there in the first place):


org/apache/axis/utils/JavaUtils.java line 246-254

        // Convert between Calendar and java.util.Date
        if (arg instanceof Calendar && destClass == java.util.Date.class) {
            return ((Calendar) arg).getTime();
        }

        // Convert between Calendar and java.sql.Date
        if (arg instanceof Calendar && destClass == java.sql.Date.class) {
            return new java.sql.Date(((Calendar) arg).getTimeInMillis());
        }

regards
Joachim


Mime
View raw message