Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2673

Axis CalendarSerializer ignores the TimeZone while formatting the date

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None

      Description

      While serializing java.util.Calendar object CalendarSerializer class ignores the Timezone set in the calendar object.
      It always considers the date object to be in the default timezone.

      Default behaviour of Axis is to convert the date to GMT.But if the passed in date or calendar object is already in GMT timezone, it should preserve the time as such.

      But getValueAsString(Object value, SerializationContext context) method in the CalendarSerializer takes in a parameter of Object type, and then uses Calendar.getTime() to get the Date.This results in creating a new java.util.Date object with default timezone and hence the original Timeone associated with the Calendar object is lost.

      The issue is that the Date returned by Calendar.getTime() doesn't maintain the calendar's time zone , and developers at sun says this is by design.

      Axis then formats this date object to GMT and results in incorrect time.
      But the actual Calendar object passed in was already in GMT.

      Axis should have taken care of checking the Calendar's Timezone and format the date accordingly, instead of blindly believing it to be in the default TimeZone.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              giljoscaria Giljo Scaria
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: