JDK-8217609 : New era placeholder not recognized by java.text.SimpleDateFormat
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 11.0.2
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-01-23
  • Updated: 2019-06-27
  • Resolved: 2019-01-29
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 12 JDK 13 JDK 8 Other
11.0.3-oracleFixed 12.0.1Fixed 13 b06Fixed 8u211Fixed openjdk8u212Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
System.out.println(new SimpleDateFormat("Y-M-d", Locale.US).format(new SimpleDateFormat("GGGGy���M���d���", Locale.forLanguageTag("ja-JP-u-ca-japanese")).parse("������1���5���1���")))

Expected Result: 
2019-5-1

Actual Result: 
java.text.ParseException: Unparseable date: "������1���5���1���"
|        at DateFormat.parse (DateFormat.java:395)
|        at (#55:1)


On the other hand, 

System.out.println(new SimpleDateFormat("Y-M-d", Locale.US).format(new SimpleDateFormat("GGGGy���M���d���", Locale.forLanguageTag("ja-JP-u-ca-japanese")).parse("NewEra1-5-1")))

Expected Result:
=> 2019-5-1

Actual Result:
java.text.ParseException: Unparseable date: "NewEra1-5-1"
|        at DateFormat.parse (DateFormat.java:395)
|        at (#2:1)

Comments
Fix Request for 8u The fix need to be back port to 8u release as it part of Japanese era changes under JDK-8202088. The fix is important so that place holder for new era is recognized by java.text.SimpleDateFormat. The back port from 13 to 8u is not a clean back. The review of changes can be found at https://mail.openjdk.java.net/pipermail/core-libs-dev/2019-March/058786.html. All regression tests are run and are found be successful.
04-03-2019

Fix Request for 12u The fix need to be back port to 12u release as it part of Japanese era changes under JDK-8202088. The fix is important so that place holder for new era is recognized by java.text.SimpleDateFormat. The back port is clean back port from 13 to 12u. All regression tests are run and are found be successful.
01-03-2019

Fix Request for 11u The fix need to be back port to 11u release as it part of Japanese era changes under JDK-8202088. The fix is important so that place holder for new era is recognized by java.text.SimpleDateFormat. The back port is clean back port from 13 to 11u. All regression tests are run and are found be successful.
01-03-2019

Wok Around: -Djava.locale.providers=COMPAT,CLDR,SPI
28-01-2019

The reason for this behavior is that CLDR provider does not provide Japanese name for the new era. Since it is just lacking the new era translation but other era names are there, JapaneseImperialCalendar supplements it with the default era name "NewEra" which is causing this parsing behavior. Although CLDR data is not owned by us, it is desirable to add the Japanese new era name in CLDR ja.xml as an exceptional case.
23-01-2019