RFR: 8284673: Collapse identical catch branches in java.management

David Holmes dholmes at openjdk.java.net
Tue Apr 12 01:52:38 UTC 2022


On Fri, 8 Apr 2022 12:19:03 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

Nice cleanup! Great to see the code duplication gone.

One minor additional edit requested below.

Thanks,
David

src/java.management/share/classes/javax/management/relation/RelationService.java line 1920:

> 1918:             } catch (InstanceNotFoundException | ReflectionException exc1) {
> 1919:                 throw new RuntimeException(exc1.getMessage());
> 1920:             } catch (MBeanException exc3) {

Please change exc3 to exc2

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

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8161


More information about the serviceability-dev mailing list