JDK-8227127 : Era designator not displayed correctly using the COMPAT provider
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 11.0.3
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-07-03
  • Updated: 2020-08-27
  • Resolved: 2019-07-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14 JDK 8
11.0.6-oracleFixed 13 b29Fixed 14Fixed 8u251Fixed
Related Reports
Relates :  
Description
SimpleDateformat doesn't display era designator correctly in Japanese locale with the COMPAT provider. 

Since it works fine in JDK 8 as well as with using the CLDR provider of JDK 11.  The issue is a regression bug from JDK 8. 

//JDK 11 with COMPAT provider 
$ java -showversion -Djava.locale.providers=COMPAT  Test 
java version "11.0.3" 2019-04-16 LTS 
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS) 
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode) 

AD19���07���03��� 10���50���01���

//JDK 11 with CLDR provider 
$ java -showversion -Djava.locale.providers=CLDR  Test 
java version "11.0.3" 2019-04-16 LTS 
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS) 
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode) 

������19���07���03��� 10���50���08���
Comments
Fix Request (OpenJDK 11u): Please approve backporting this to JDK 11. The JDK 13 patch applies with minor modification in test code (bug reference didn't match due to JDK-8221432). Tier 1 testing passed. JDK 11u webrev reviewed by Naoto Sato. webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8227127/01/webrev/ RFR: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-July/001417.html
16-07-2019

[~neato] Thanks for clearing that up! Confirmed JDK 8u is not affected: $ java -showversion -Duser.language=ja -Djava.locale.providers=JRE Test openjdk version "1.8.0_222-ea" OpenJDK Runtime Environment (build 1.8.0_222-ea-b08) OpenJDK 64-Bit Server VM (build 25.222-b08, mixed mode) ������19���07���09��� 15���36���12��� $ java -showversion -Duser.language=ja -Djava.locale.providers=CLDR Test openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment 18.9 (build 11.0.3+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.3+7, mixed mode, sharing) ������19���07���09��� 15���38���37��� $ java -showversion -Duser.language=ja -Djava.locale.providers=COMPAT Test openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment 18.9 (build 11.0.3+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.3+7, mixed mode, sharing) AD19���07���09��� 15���38���47���
09-07-2019

This is a regression starting from JDK9, so JDK8 famiies are not affected. [~sgehwolf], you need to run it under Japanese locale, i.e., with -Duser.language=ja.
09-07-2019

This seems to affect OpenJDK 11/8 as well: $ java -showversion -Djava.locale.providers=JRE Test openjdk version "1.8.0_222-ea" OpenJDK Runtime Environment (build 1.8.0_222-ea-b08) OpenJDK 64-Bit Server VM (build 25.222-b08, mixed mode) AD19���07���09��� 10���49���20��� $ java -showversion -Djava.locale.providers=CLDR Test openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment 18.9 (build 11.0.3+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.3+7, mixed mode, sharing) AD19���07���09��� 10���51���31���
09-07-2019

With the fix to JDK-8039301, era names are retrieved from locale provider's CalendarNameProvider implementation, instead of DateFormatSymbols.getEras(). COMPAT provider has not been providing Japanese era names for Gregorian calendar through CalendarNameProvider, thus it is falling back to root locale's names.
08-07-2019

The issue is reproducible in the mainline JDK.
03-07-2019