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

Bidi.requiresBidi has misleading exception message

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 16
    • core-libs
    • None
    • b22

    Description

      jshell> Bidi.requiresBidi("AAAAAAAAA".toCharArray(), 2,20)
      | Exception java.lang.IllegalArgumentException: Value start 2 is out of range 0 to 20
      | at BidiBase.requiresBidi (BidiBase.java:4543)
      | at Bidi.requiresBidi (Bidi.java:304)
      | at (#2:1)

      The emitted statement "Value start 2 is out of range 0 to 20" is false.
      The exception message is created here [1] and is based on more than the simple size check. This leads to the incorrect message.

      4542 if (0 > start || start > limit || limit > text.length) {
      4543 throw new IllegalArgumentException("Value start " + start +
      4544 " is out of range 0 to " + limit);
      4545 }

      [1] https://java.se.oracle.com/source/xref/jdk-jdk/open/src/java.base/share/classes/jdk/internal/icu/text/BidiBase.java#4542

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              mschoene Marc Schönefeld
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: