JDK-8209682 : DateFormat for Malaysia "my" causes IllegalArgumentException: Illegal pattern character 'B'
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-08-18
  • Updated: 2018-09-04
  • Resolved: 2018-08-20
Related Reports
Duplicate :  
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



Comments
The locale for Malaysia is ms_MY, for this the code works fine.The issue happens for 'my' locale (Burmese) and this is being resolved through JDK-8209047.
20-08-2018