You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/09/30 21:26:41 UTC

DO NOT REPLY [Bug 13154] New: - BeanDeser... and java.sql.Date

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13154>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13154

BeanDeser... and java.sql.Date

           Summary: BeanDeser... and java.sql.Date
           Product: Axis
           Version: 1.0-rc2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: joachim@bizlink.se
                CC: joachim@bizlink.se,tomj@macromedia.com


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