Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8245036 DataInputStream.readFully(byte[], int, int) does not throw expected IndexOutOfBoundsExceptions
  3. JDK-8279631

Release Note: DataInputStream:readFully now correctly throws specified exceptions

XMLWordPrintable

    • 16
    • generic
    • generic
    • Verified

      `DataInputStream.readFully(byte[] b, int off, int len)` now correctly throws specified `NullPointerException` and `IndexOutOfBoundsException`.

      `DataInputStream.readFully(byte[] b, int off, int len)` is specified to throw a `NullPointerException` if `b` is `null`, and an `IndexOutOfBoundsException` if `off` is negative, `len` is negative, or `len` is greater than `b.length - off`. For example if `b` was `null` and `len` was zero, then the method would fail silently without throwing a `NullPointerException`. Also if `b` was non-`null`, `off` was negative and `len` was zero, then the method would fail silently without throwing an `IndexOutOfBoundsException`. The implementation has been corrected to throw the respective exceptions as specified.

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

              Created:
              Updated:
              Resolved: