RFR: 8262297: ImageIO.write() method will throw IndexOutOfBoundsException
Phil Race
prr at openjdk.java.net
Fri Oct 29 07:35:11 UTC 2021
On Thu, 28 Oct 2021 09:29:13 GMT, Masanori Yano <myano at 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.
This needs looking at closely .. I don't know what's best but the imaging APIs are very exception heavy because of the arrays, indices, you name it that they consume. Most of the time its probably best for an IIO user to just get an IIOException wrapping the original cause. But there could be exceptions.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6151
More information about the core-libs-dev
mailing list