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 "Jeff Peterson (JIRA)" <ji...@apache.org> on 2007/01/30 00:04:49 UTC

[jira] Reopened: (AXIS2-820) ConverterUtil does not handle time zones correctly in convertToString(Calendar)

     [ https://issues.apache.org/jira/browse/AXIS2-820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Peterson reopened AXIS2-820:
---------------------------------


Here's a unit test which fails and illustrates the problem:

    public void testConvertToString() {
        try {
            String dateStr = "Wed Jun 14 13:33:50 PDT 2006";
            SimpleDateFormat format = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy");
            
            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(format.parse(dateStr));
            
            String convertedStr = ConverterUtil.convertToString(cal);
            System.out.println(convertedStr);
           
            assertEquals("Date converted correctly", "2006-06-14T20:33:50.000Z", convertedStr);
            
        } catch (ParseException e) {
           e.printStackTrace();
            fail(e.getMessage());
        }
    }

> ConverterUtil does not handle time zones correctly in convertToString(Calendar)
> -------------------------------------------------------------------------------
>
>                 Key: AXIS2-820
>                 URL: https://issues.apache.org/jira/browse/AXIS2-820
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.0
>            Reporter: Jeff Peterson
>         Assigned To: Deepal Jayasinghe
>
> If convertToString(Calendar) is passed a calendar object with a timezone other than GMT/UTC/Zulu, it is not treated appropriately.  
> For example, if I pass (Wed Jun 14 13:33:50 PDT 2006) as a calendar object, it is formatted by convertToString() to "2006-06-14T13:33:50.784Z".  Notice the GMT/UTC/Zulu designation "Z" at the end of the string.  Clearly these two dates are not equivalent.  convertToString() should return either "2006-06-14T13:33:50.784-7:00" or "2006-06-14T20:33:50.784Z"
> See: modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java:136

-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org