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

DateFormat for Malaysia "my" causes IllegalArgumentException: Illegal pattern character 'B'

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Linux 64-bit, Ubuntu 16.04

      A DESCRIPTION OF THE PROBLEM :
      When running the following Java snippet with Java 11, an exception is thrown:

      Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'B'
              at java.base/java.text.SimpleDateFormat.compile(SimpleDateFormat.java:845)
              at java.base/java.text.SimpleDateFormat.applyPatternImpl(SimpleDateFormat.java:2350)
              at java.base/java.text.SimpleDateFormat.applyPattern(SimpleDateFormat.java:2346)
              at java.base/sun.util.locale.provider.DateFormatProviderImpl.getInstance(DateFormatProviderImpl.java:160)
              at java.base/sun.util.locale.provider.DateFormatProviderImpl.getDateTimeInstance(DateFormatProviderImpl.java:143)
              at java.base/java.text.DateFormat.get(DateFormat.java:843)
              at java.base/java.text.DateFormat.get(DateFormat.java:827)
              at java.base/java.text.DateFormat.getDateTimeInstance(DateFormat.java:615)
              at JDK11TestLocaleMy.main(JDK11TestLocaleMy.java:8)


      REGRESSION : Last worked in version 10.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the snippet via "javac /tmp/JDK11TestLocaleMy.java, then execute it via "java -cp /tmp JDK11TestLocaleMy"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Only "Locale: my" should be printed, the call to DateFormat.getDateTimeInstance() should work fine.
      ACTUAL -
      An exception "IllegalArgumentException: Illegal pattern character 'B'" is reported.

      ---------- BEGIN SOURCE ----------
      import java.text.DateFormat;
      import java.util.Locale;

      public class JDK11TestLocaleMy {
          public static void main(String[] args) throws Exception {
      System.out.println("Locale: " + Locale.forLanguageTag("my"));

      DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.forLanguageTag("my"));
      }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psonal Pallavi Sonal
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: