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.
JDK 8
8 b65Fixed
Description
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. 
Comments
Verified in b64.
13-11-2012

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.
30-10-2012