RFR: 8262297: ImageIO.write() method will throw IndexOutOfBoundsException [v4]
Jayathirth D V
jdv at openjdk.java.net
Tue Nov 23 11:18:10 UTC 2021
On Fri, 19 Nov 2021 09:04:22 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.
>
> Masanori Yano has updated the pull request incrementally with two additional commits since the last revision:
>
> - 8262297: ImageIO.write() method will throw IndexOutOfBoundsException
> - 8262297: ImageIO.write() method will throw IndexOutOfBoundsException
test/jdk/javax/imageio/plugins/bmp/BMPBitsPerPixelTest.java line 62:
> 60: }
> 61: BufferedImage img = new BufferedImage(10, 10, imageType, (IndexColorModel)cm);
> 62: ImageIO.write(img, "BMP", new File("test.bmp"));
Just noticed before sponsoring that this test will leave test.bmp file.
We should create temporary file and delete it on exit.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6151
More information about the client-libs-dev
mailing list