-
Enhancement
-
Resolution: Not an Issue
-
P3
-
None
-
23
It's more of a clarification issue to understand the behavioral difference for MessageFormat::toPattern() between JDK 22 vs JDK23 w.r.to Chinese Locale.
One of the old test in JCK failing in 23 when run with Non English Windows (LOCALE=zh_CN) , for more details - https://bugs.openjdk.org/browse/JCK-7321556
This test was OK in 22, but failing in 23.
I understand the toPattern() behavior varies based on Locale.
But this specific case where the format style is explicitly specified looks not honored in JDK23. Please see the stand alone code attached
===
String initPattern = "{3,number,0.0}";
MessageFormat mf = new MessageFormat(initPattern);
Format formatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
mf.setFormat(0, formatter);
String newPattern = mf.toPattern();
out.println("The pattern is " + newPattern);
String expPatterns[] = {"{3,date}", "{3,date,medium}"};
...
===
Run results : JDK 22 the test is OK, in JDK 23 it's failing.
===
C:\Diffs>C:\Project\JDK-22\b25\jdk-22\bin\java -Duser.language=zh ToPattern_InChineseLocale
The pattern is {3,date}
OK
C:\Diffs>C:\Project\JDK-23\b25\jdk-23\bin\java.exe -Duser.language=zh ToPattern_InChineseLocale
The pattern is {3,date,long}
New pattern is not one of the expected one: new Pattern is : {3,date,long} Expected Patterns : [{3,date}, {3,date,medium}]
One of the old test in JCK failing in 23 when run with Non English Windows (LOCALE=zh_CN) , for more details - https://bugs.openjdk.org/browse/JCK-7321556
This test was OK in 22, but failing in 23.
I understand the toPattern() behavior varies based on Locale.
But this specific case where the format style is explicitly specified looks not honored in JDK23. Please see the stand alone code attached
===
String initPattern = "{3,number,0.0}";
MessageFormat mf = new MessageFormat(initPattern);
Format formatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
mf.setFormat(0, formatter);
String newPattern = mf.toPattern();
out.println("The pattern is " + newPattern);
String expPatterns[] = {"{3,date}", "{3,date,medium}"};
...
===
Run results : JDK 22 the test is OK, in JDK 23 it's failing.
===
C:\Diffs>C:\Project\JDK-22\b25\jdk-22\bin\java -Duser.language=zh ToPattern_InChineseLocale
The pattern is {3,date}
OK
C:\Diffs>C:\Project\JDK-23\b25\jdk-23\bin\java.exe -Duser.language=zh ToPattern_InChineseLocale
The pattern is {3,date,long}
New pattern is not one of the expected one: new Pattern is : {3,date,long} Expected Patterns : [{3,date}, {3,date,medium}]