RFR: 8284673: Collapse identical catch branches in java.management
Chris Plummer
cjplummer at openjdk.java.net
Tue Apr 12 00:21:36 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
Marked as reviewed by cjplummer (Reviewer).
src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java line 1198:
> 1196: throw new RuntimeOperationsException(ree,
> 1197: "RuntimeException occurred in RequiredModelMBean "+
> 1198: "while trying to invoke operation " + opName);
This one is a bit different. You've collapsed RuntimeOperationsException into the RuntimeException handler, which seems fine since it is a subclass of RuntimeException and both handlers do the same thing. However, I wonder if the original intent of the RuntimeOperationsException handler was for it to have a different message, and perhaps reference RuntimeOperationsException instead of RuntimeException.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8161
More information about the serviceability-dev
mailing list