On Tue, 12 Apr 2022 00:12:42 GMT, Chris Plummer <cjplum...@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
>
> 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.

The proposed change is behaviour preserving so I have no issue with it. If 
something else was intended then that would be a new RFE IMO.

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

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

Reply via email to