JDK-8001205 : Calendar.getDisplayName(...): Returns null when provider is SPI but there is no SPI implementation
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-10-22
  • Updated: 2012-11-16
  • Resolved: 2012-11-07
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.
8 b65Fixed
Run the attached test program, with -Djava.locale.providers=SPI, but no implementation of CalendarDataProvider is in the java extension directory. In this case, the value got from JRE adapter should be returned, but the returned value is null.

This only happens when type is STANDALONE. For example, String sunday = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT_STANDALONE, new Locale(args[0], args[1]));

If the type is not STANDALONE, for example, String sunday = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT_FORMAT, new Locale(args[0], args[1])), the return value will be from JRE, not null.

For other methods like getFirstDayOfWeek(), program still returns the value from JRE adapter, when there is no SPI implementation.

Attached is the screen shot of program output. 
Verified in b64.

In the case there is no explicit "JRE" locale provider adapter in the providers list, "FALLBACK" provider should kick in for the ROOT locale. However, the logic in LocaleServiceProviderPool did not account for the fallback provider. Thus "null" was returned.