JDK-8228477 : Have calendar revert to default names if no standalone resources exist
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8u211
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-07-22
  • Updated: 2021-01-04
  • Resolved: 2020-02-25
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 8
8u261 b01Fixed
Description
Japanese locale data in the COMPAT provider of JDK 11 is not same as that of JDK 8. 
The Java doc mentions the COMPAT provider is prepared to keep compatibility of 
locale data with ealier releases.  The data in JDK 11 should be consistent with JDK 8. 

$ ${JDK11}/java -Djava.locale.providers=COMPAT Sample2 
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) 
ERA - SHORT_FORMAT:{BM=0, H=4, M=1, R=5, S=3, T=2} 
ERA - SHORT_STANDALONE:{BM=0, H=4, M=1, R=5, S=3, T=2} 
ERA - NARROW_FORMAT:{BM=0, H=4, M=1, R=5, S=3, T=2} 
ERA - NARROW_STANDALONE:{BM=0, H=4, M=1, R=5, S=3, T=2} 
MONTH - SHORT_STANDALONE:{10=9, 11=10, 12=11, 1=0, 2=1, 3=2, 4=3, 5=4, 6=5, 
7=6, 8=7, 9=8} 
MONTH - LONG_STANDALONE:{10���=9, 11���=10, 12���=11, 1���=0, 2���=1, 3���=2, 4���=3, 5���=4, 6���=5, 7���=6, 8���=7, 9���=8}
MONTH - NARROW_STANDALONE:{10=9, 11=10, 12=11, 1=0, 2=1, 3=2, 4=3, 5=4, 6=5, 7=6, 8=7, 9=8}
DAY_OF_WEEK - NARROW_STANDALONE:{���=7, ���=1, ���=2, ���=5, ���=4, ���=3, ���=6}

$ ${JDK8}/java -showversion Sample2 
java version "1.8.0_211" 
Java(TM) SE Runtime Environment (build 1.8.0_211-b08) 
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b08, mixed mode) 

ERA - SHORT_FORMAT:{H=4, M=1, R=5, S=3, T=2} 
ERA - SHORT_STANDALONE:{H=4, M=1, R=5, S=3, T=2} 
ERA - NARROW_FORMAT:{H=4, M=1, R=5, S=3, T=2} 
ERA - NARROW_STANDALONE:{H=4, M=1, R=5, S=3, T=2} 
MONTH - SHORT_STANDALONE:null 
MONTH - LONG_STANDALONE:null 
MONTH - NARROW_STANDALONE:null 
DAY_OF_WEEK - NARROW_STANDALONE:null 
Comments
Use this bug record to fix up issues in JDK 8u where standalone requests in calendar display don't return default values when no specific standalone values exist. This will be similar behaviour to what's done in JDK 11.
24-02-2020

I'm not sure if we can ever say that they'll be 100% compatibility on output between two JDK family releases when the COMPAT flag value is used. This is especially true when new data needs to be added in real time (like the recent new Japanese Era) -- I do see a window for improvement in the JDK 8 behaviour however : /jdk1.8.0_231/bin/java Sample2 ERA - SHORT_FORMAT:{H=4, M=1, R=5, S=3, T=2} ERA - SHORT_STANDALONE:{H=4, M=1, R=5, S=3, T=2} ERA - NARROW_FORMAT:{H=4, M=1, R=5, S=3, T=2} ERA - NARROW_STANDALONE:{H=4, M=1, R=5, S=3, T=2} MONTH - SHORT_STANDALONE:null MONTH - LONG_STANDALONE:null MONTH - NARROW_STANDALONE:null DAY_OF_WEEK - NARROW_STANDALONE:null The null values are not seen in JDK 11 usage. We can add patch to CalendarNameProviderImpl.java so that the default key value is queried if none exists for the "standalone" key value. + // If standalone names are requested and no "standalone." resources are found, + // try the default ones instead. + if (strings == null && key.indexOf("standalone.") != -1) { + key = key.replaceFirst("standalone.", ""); + strings = javatime ? lr.getJavaTimeNames(key) : lr.getCalendarNames(key); + } + Similar was done in JDK 11 via CLDR work. JDK 8u patch would now output: /images/j2sdk-image/bin/java Sample2 ERA - SHORT_FORMAT:{H=4, M=1, R=5, S=3, T=2} ERA - SHORT_STANDALONE:{H=4, M=1, R=5, S=3, T=2} ERA - NARROW_FORMAT:{H=4, M=1, R=5, S=3, T=2} ERA - NARROW_STANDALONE:{H=4, M=1, R=5, S=3, T=2} MONTH - SHORT_STANDALONE:{10=9, 11=10, 12=11, 1=0, 2=1, 3=2, 4=3, 5=4, 6=5, 7=6, 8=7, 9=8} MONTH - LONG_STANDALONE:{10���=9, 11���=10, 12���=11, 1���=0, 2���=1, 3���=2, 4���=3, 5���=4, 6���=5, 7���=6, 8���=7, 9���=8} MONTH - NARROW_STANDALONE:{10=9, 11=10, 12=11, 1=0, 2=1, 3=2, 4=3, 5=4, 6=5, 7=6, 8=7, 9=8} DAY_OF_WEEK - NARROW_STANDALONE:{���=7, ���=1, ���=2, ���=5, ���=4, ���=3, ���=6}
12-11-2019