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

(bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • None
    • core-libs
    • b13
    • generic
    • generic

      A number of bounds checks are performed in the $Type$Buffer classes using the package-scope method java.nio.Buffer.checkBounds() which has an empty message:

          static void checkBounds(int off, int len, int size) { // package-private
              if ((off | len | (off + len) | (size - (off + len))) < 0)
                  throw new IndexOutOfBoundsException();
          }

      It would be better to have some more information on what failed, for example, to use java.util.Objects.checkFromIndexSize() instead.

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: