JDK-8007038 : ArrayIndexOutOfBoundsException on calling localizedDateTime().print() with JapaneseChrono
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2013-01-28
  • Updated: 2013-02-22
  • Resolved: 2013-02-08
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 b78Fixed
Description
Demo code: 

            Locale l = new Locale("ja", "JP", "JP");
            Chrono.getAvailableChronologies(); // work around to force init Chrono
            Chrono c = Chrono.ofLocale(l);
            DateTimeFormatter l10nF = DateTimeFormatters.localizedDateTime(FormatStyle.FULL, FormatStyle.FULL)
                    .withChrono(c).withLocale(l);

This piece throws the following exception:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
	at sun.util.locale.provider.CalendarNameProviderImpl.getDisplayName(CalendarNameProviderImpl.java:61)
	at sun.util.locale.provider.CalendarDataUtility$CalendarFieldValueNameGetter.getObject(CalendarDataUtility.java:110)
	at sun.util.locale.provider.CalendarDataUtility$CalendarFieldValueNameGetter.getObject(CalendarDataUtility.java:95)
	at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObjectImpl(LocaleServiceProviderPool.java:299)
	at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObject(LocaleServiceProviderPool.java:283)
	at sun.util.locale.provider.CalendarDataUtility.retrieveFieldValueName(CalendarDataUtility.java:68)
	at java.time.format.DateTimeTextProvider.getEraText(DateTimeTextProvider.java:184)
	at java.time.format.DateTimeFormatterBuilder$TextPrinterParser.print(DateTimeFormatterBuilder.java:2362)
	at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.print(DateTimeFormatterBuilder.java:1567)
	at java.time.format.DateTimeFormatterBuilder$LocalizedPrinterParser.print(DateTimeFormatterBuilder.java:3260)
	at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.print(DateTimeFormatterBuilder.java:1567)
	at java.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:335)
	at java.time.format.DateTimeFormatter.print(DateTimeFormatter.java:307)