RFR: 8272998: ImageIO.read() throws incorrect exception type

Phil Race prr at openjdk.org
Mon Jun 27 21:59:38 UTC 2022


On Mon, 27 Jun 2022 21:41:07 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>>> Other exception types are possible or very difficult to prove they won't be thrown anprop if it ever did happen
>> we'd be back here
>> 
>> But then it will mean that the "read" thrown wrong exceptions, Isn't this just hiding the actual bug?
>
> In the end, the ImageIO method we change is just a wrapper for getting and using the reader, and that unexpected exception could be thrown if the readers are used directly via a similar public API.

It is a wrapper that is intended to hide lots of details - such as this.
A sophisticated app which wants to use ImageReader.read() should be ready to handle those
An app that just wants a quick and easy API with no random exceptions wants ImageIO.read().
And as I said the exception is wrapped so it can still be inspected.

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

PR: https://git.openjdk.org/jdk/pull/9113



More information about the client-libs-dev mailing list