Hello, > new RuntimeException(exc1.getMessage())
I typically try to avoid swallowing the cause and especially the exception type of a inner exception, especially in this case where two different exceptions are caught. Better do tostring() and/or specify the exception as a cause to have chaining? -- https://bernd.eckenfels.net ________________________________ From: serviceability-dev <serviceability-dev-r...@openjdk.java.net> on behalf of David Holmes <dhol...@openjdk.java.net> Sent: Tuesday, April 12, 2022 3:52:38 AM To: serviceability-dev@openjdk.java.net <serviceability-dev@openjdk.java.net> Subject: Re: RFR: 8284673: Collapse identical catch branches in java.management 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 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