On Fri, 8 Apr 2022 12:19:03 GMT, Andrey Turbanov <aturba...@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

Reply via email to