RFR: 8284672: Collapse identical catch branches in java.desktop [v2]
Andrey Turbanov
aturbanov at openjdk.java.net
Wed Jun 1 20:55:34 UTC 2022
On Wed, 27 Apr 2022 04:40:29 GMT, Phil Race <prr at openjdk.org> wrote:
>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8284672: Collapse identical catch branches in java.desktop
>> fix formatting
>
> src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java line 610:
>
>> 608: }
>> 609: } catch (MalformedURLException ex) {
>> 610: // OK to just ignore. We'll use a fallback theme.
>
> subclass of IOException I suppose
Yes. `MalformedURLException extends IOException`
> src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java line 50:
>
>> 48: try {
>> 49: return new DLSSoundbank(url);
>> 50: } catch (IOException e) {
>
> So how can this method throw the declared IOException ?
> Hmm I suppose the API super-class declares it is
Yep. Inherited throws section from a super method
> src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java line 50:
>
>> 48: try {
>> 49: return new SF2Soundbank(url);
>> 50: } catch (IOException e) {
>
> same here
Yeah. I think it makes sense to amend behavior here and not catch IOException. Callers should be ready for it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8154
More information about the client-libs-dev
mailing list