[ 
https://issues.apache.org/jira/browse/AXIS2-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514966
 ] 

Sathija Pavuluri commented on AXIS2-3001:
-----------------------------------------

The Date object in java contains a complete timestamp with date and time. 
It should be mapped to a dateTime value in XML.

When the Date object is serialized, Axis is serializing it to a dateTime xml 
value (as can be seen in the xml response in my earlier comment).  
But when it's deserialized, it's attempting to deserialze it as a date xml 
value which causes the above exception.

The name "Date" in java is a bit misleading, it's not really just a date, it's 
a timestamp and should be mapped as such to xml.

Axis is now mapping the Calendar object to xml dateTime, but developers seldom 
use Calendar for literal date (and dateTime) representation.
Calendar is a heavier weight object and is mostly used when date manipulations 
and conversions are to be made.

This approach that Axis is taking forces Calendar object to be used for 
dateTime representation when java does provide the more convenient Date object.
This may also be breaking backward compatibility forcing all Date objects that 
were used for timestamp representation be changed to Calendar objects. 

> Problem in 1.3 RC with deserialization of java.util.Date objects that are 
> DateTime formatted.
> ---------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3001
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3001
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: Axis 1.3 RC2, JDK 1.6 on Linux
>            Reporter: Sathija Pavuluri
>            Assignee: Amila Chinthaka Suriarachchi
>            Priority: Blocker
>
> This bug was introduced after the fix that was made for jira AXIS2-2701.
> I had originally written my comment against 2701 but since the bug is marked 
> as resolved, thought this new issue should be tracked separately.
> The fix for AXIS2-2701 makes it impossible for java.util.Date objects to be 
> deserialized when the date is datetime formatted (i.e. yyyy-mm-dd hh:mm:ss). 
> It now only works for date format  objects (i.e. yyyy-mm-dd)
> For example I have an object with attribute:
> java.util.Date timeStarted;
> The element in the response looks like this:
> <ax26:timeStarted>2007-07-23T13:20:46.861Z</ax26:timeStarted>
> The deserialization of this element fails with this exception:
>         java.lang.RuntimeException: In valid string sufix
>         at 
> org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:378)
>         at 
> org.apache.axis2.databinding.typemapping.SimpleTypeMapper.makeDate(SimpleTypeMapper.java:304)
>         at 
> org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:117)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:364)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:644)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:592)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:528)
> Looking at the code, it seems like the ConverterUtil expects the Date object 
> to be only of yyyy-mm-dd format.
> It fails in the case when Date is yyyy-mm-dd hh:mm:ss formatted?  
> Thanks,
> Sathija. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to