RFR: 8322877: java/io/BufferedInputStream/TransferTo.java failed with IndexOutOfBoundsException

Brian Burkhalter bpb at openjdk.org
Wed Jan 3 18:07:53 UTC 2024


On Wed, 3 Jan 2024 18:01:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> The final position instead of the number of bytes to write was being passed to `ByteArrayOuputStream.write(byte[],int,int)`.

Everyone was apparently caught off guard as previously `Arrays.copyOfRange(byte[],int,int)` had been used here, and its third parameter is the `to` position, not the number of bytes to copy.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17250#issuecomment-1875761630


More information about the core-libs-dev mailing list