XStream
  1. XStream
  2. XSTR-740

Incorrect Locale for Calendar creation used in ISO8601GregorianCalendarConverter

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4.4
    • Fix Version/s: 1.4.5
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      Oracle jdk1.7.0_21 for Mac OS X 10.8.4

      Description

      As of JDK 7, the default locale supports categories. This enables the separation between display and format locales.

      I have my system set to English, but use German number and date formats (Basically, everything is english, but the calendar format and style is german, i.e. monday is the first day of the week instead of sunday etc).

      The constructor of GregorianCalendar uses Locale.getDefault(Locale.Category.FORMAT) internally to create a calendar, whereas the ISO8601GregorianCalendarConverter uses Locale.getDefault().

      On my system, those two differ and therefore, the calendar returned by the converter is created with a different locale than a regular new Calendar(…) would create. And due to the weird implementation of date handling in Java, those two are not equal (Calendar equality is locale dependent).

      I would expect two calendars, one created by xstream and one via new GregorianCalendar(…) to be equal and consider their inequality to be a bug.

      I've created a failing unit test as well.

      I assume a fix should be straight forward - it would however probably break JDK6 compatibility. Still, I'd be glad if you could fix it in an upcoming release.

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Moritz Grauel
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: