On Thu, 28 Oct 2021 09:29:13 GMT, Masanori Yano <myano@openjdk.org> wrote:
Could you please review the 8262297 bug fixes?
In this case, ImageIO.write() should throw java.io.IOException rather than java.lang.IndexOutOfBoundsException. IndexOutOfBoundsException is caught and wrapped in IIOException in ImageIO.write() with this fix. In addition, IndexOutOfBoundsException is not expected to throw by RandomAccessFile#write() according to its API specification. So it should be fixed.
src/java.base/share/classes/java/io/RandomAccessFile.java line 558:
556: * @throws IndexOutOfBoundsException If {@code off} is negative, 557: * {@code len} is negative, or {@code len} is greater than 558: * {@code b.length - off}
The IOOBE is specified in the super interface, it's just not shown in the javadoc because it's a runtime exception. So I think what you want here is: @throws IndexOutOfBoundsException {@inheritDoc} ------------- PR: https://git.openjdk.java.net/jdk/pull/6151