RFR: 8284672: Collapse identical catch branches in java.desktop
Phil Race
prr at openjdk.java.net
Wed Apr 27 17:52:48 UTC 2022
On Fri, 8 Apr 2022 06:50:15 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Let's take advantage of Java 7 language feature - "Catching Multiple Exception Types".
> It simplifies code. Reduces duplication.
> Found by IntelliJ IDEA inspection Identical 'catch' branches in 'try' statement
Marked as reviewed by prr (Reviewer).
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
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
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
-------------
PR: https://git.openjdk.java.net/jdk/pull/8154
More information about the client-libs-dev
mailing list