Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139627

1.8.0_60 breaks SimpleDateFormat for "LLL"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u60
    • core-libs
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Java 1.8.0_60 64 Bit, Windows 7 64 Bit.

      A DESCRIPTION OF THE PROBLEM :
      Java 8 introduced changed default DateFormatSymbols (JDK-7079560). As our code relies on the 3 letter month code, we noticed that the former "MRZ" (MMM) suddenly was "MÄR" - we have german system language. So we changed our complete code to use "LLL" instead of "MMM". This worked at least untill 1.8.0_51.

       With 1.8.0_60, we get "MÄR" again instead of "MRZ".

      REGRESSION. Last worked in version 8u51

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Here's is a simple test case:

      -----------------
              GregorianCalendar c = new GregorianCalendar();
              c.set(2014, 2, 13);
              final Date d = c.getTime();

              final String s = d.toInstant().atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyyLLL", Locale.GERMAN)); //1.8.0_60: "2014Mär", 1.8.0_51: "2014Mrz"
              System.out.println("Formatted (expected '2014Mrz' up to 1.8.0_51): "+s);
      ---------------


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      2014Mrz
      ACTUAL -
      2014Mär

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              GregorianCalendar c = new GregorianCalendar();
              c.set(2014, 2, 13);
              final Date d = c.getTime();

              final String s = d.toInstant().atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyyLLL", Locale.GERMAN)); //1.8.0_60: "2014Mär", 1.8.0_51: "2014Mrz"
              System.out.println("Formatted (expected '2014Mrz' up to 1.8.0_51): "+s);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None that I know of. I tried pattern "yyyyMMM" instead of "yyyyLLL", but the result is the same wrong string "2014Mär" (instead of "2014Mrz").

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: