RFR: 8284672: Collapse identical catch branches in java.desktop [v2]

Alexey Ivanov aivanov at openjdk.org
Fri Jun 17 14:00:02 UTC 2022


On Thu, 16 Jun 2022 03:49:34 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Yeah. I think it makes sense to amend behavior here and not catch IOException. Callers should be ready for it.
>
> This getSoundbank method is called when we iterate over providers and check which can be used, unfortunately, that code is not ready for the IOException and we return "null" -> the next provider will be checked. This is a kind of compatibility quirk.

Doesn't IOException mean the next provider is to be checked?

That is the IOException could be handled in the iterator, its code may need to be updated for that. Then the implementations of `getSoundbank(URL)` could propagate the IOException too and eliminate duplicate code.

`InvalidMidiDataException` isn't caught there, so the iterator code should handle it.

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

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



More information about the client-libs-dev mailing list