Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8007038

ArrayIndexOutOfBoundsException on calling localizedDateTime().print() with JapaneseChrono

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • core-libs
    • b78
    • generic
    • generic

    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)

      Attachments

        Activity

          People

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: