On Thu, 28 Oct 2021 14:30:20 GMT, Alan Bateman <al...@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}

Unfortunately the parent class does not specify this exception via javadoc tags 
like "@throws IndexOutOfBoundsException", but instead just describe it in the 
method description

should we fix it separately from the imageio fix?

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

PR: https://git.openjdk.java.net/jdk/pull/6151

Reply via email to