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/10/01 09:51:31 UTC

DO NOT REPLY [Bug 13167] New: - xsd:datetime can not be converted to java.util.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=13167>.
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=13167

xsd:datetime can not be converted to java.util.Date

           Summary: xsd:datetime can not be converted to java.util.Date
           Product: Axis
           Version: 1.0-rc2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: nbhatia@sapient.com


1.0-rc1 could convert a received xsd:datetime to java.util.Date. RC2 has lost 
this capability. The basic problem is as follows:

In rc2, BeanPropertyTarget.set(Object value) has added a check before doing the 
actual conversion:

    if (JavaUtils.isConvertable(value, type)) {
        value = JavaUtils.convert(value, type);

It is okay to add this check as long as isConvertable() returns true for all 
types that can be converted by the convert() method. However isConvertable() 
returns false if value is a GregorialCalendar and type is java.util.Date (which 
convert() will gladly convert). So the fix is to add two lines of code around 
line 511 in JavaUtils.isConvertable() as shown below:

        if (src != null) {
            ...
--->        // Allow mapping of Calendar to Date
--->        if (Calendar.class.isAssignableFrom(src) && dest == Date.class)
--->            return true;
        }

In addition, both functions, i.e. isConvertable() and convert(), should be 
checked to make sure they are fully complimentory.