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

ArrayIndexOutOfBoundsException instead of DateTimeException in j.t.chrono.JapaneseChronology.eraOf()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b50

      Backports

        Description

        The spec for the java.time.chrono.JapaneseChronology.eraOf() asserts that DateTimeException is expected if eraValue is invalid.

        https://docs.oracle.com/javase/8/docs/api/java/time/chrono/JapaneseChronology.html#eraOf-int-

        but in the case of input value Integer.MAX_VALUE: JapaneseChronology.INSTANCE.eraOf(Integer.MAX_VALUE);

        the method throws unexpected java.lang.ArrayIndexOutOfBoundsException:

        java.lang.ArrayIndexOutOfBoundsException: -2147483648
        at java.time.chrono.JapaneseEra.of(JapaneseEra.java:201)
        at java.time.chrono.JapaneseChronology.eraOf(JapaneseChronology.java:377)
        at java.time.chrono.JapaneseChronology.eraOf(JapaneseChronology.java:123)

        Due to this issue the following test will fail after integration:

        api/java_time/chrono/JapaneseChronology/index.html#eraOf

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rriggs Roger Riggs
                  Reporter:
                  ostrizhe Olga Strizhenko (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: