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

Australian locale month names contain spurious dot at the end

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Works on 1.8.0_131, does not work on java 9.0.4 and java 10.0.2.

      A DESCRIPTION OF THE PROBLEM :
      Parsing date does not work with Australian locale en_AU. Month contains dot in it. See reproducer.

      REGRESSION : Last worked in version 8u162

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This only happens with CLDR enabled. If COMPAT is used instead the problem does not happen.
      Under jdk9
      Date d = new SimpleDateFormat("dd MMM yyyy", locale).parse("01 Jan. 2006");
      gets parsed correctly but
       Date d2 = new SimpleDateFormat("dd MMM yyyy", locale).parse("01 Jan 2006");
      throws.
      See reproducer.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Jan should be parsed as proper month.
      ACTUAL -
      Exception is thrown:
      java.text.ParseException: Unparseable date: "01 Jan 2006"
      at java.base/java.text.DateFormat.parse(DateFormat.java:395)
      at LocaleTestExplicitLocale.main(LocaleTestExplicitLocale.java:12)

      ---------- BEGIN SOURCE ----------
      import java.text.SimpleDateFormat;
      import java.util.Date;
      import java.util.Locale;
      class LocaleTestExplicitLocale{
          public static void main(String[] args){
              for (Locale locale: Locale.getAvailableLocales()) {
                  if (locale.toString().equals("en_AU")) {
                      System.out.println("DisplayName: "+locale.getDisplayName());
                      try {
                          Date d = new SimpleDateFormat("dd MMM yyyy", locale).parse("01 Jan. 2006");
                          System.out.println(d);
                          Date d2 = new SimpleDateFormat("dd MMM yyyy", locale).parse("01 Jan 2006");
                          System.out.println(d2);
                          
                      } catch (Exception ex) {
                          ex.printStackTrace(System.out);
                      }
                  }
              }
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      -Djava.locale.providers=HOST,SPI,COMPAT,CLDR


      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: