On Wed, 12 Mar 2025 17:13:54 GMT, Rajat Mahajan <rmaha...@openjdk.org> wrote:
>> test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java line 131: >> >>> 129: UIManager.setLookAndFeel(laf.getClassName()); >>> 130: } catch (ClassNotFoundException | InstantiationException | >>> 131: IllegalAccessException | >>> UnsupportedLookAndFeelException e) { >> >> This can just be set to `Exception e` rather than expanding it into separate >> exceptions. > > This provides more targeted error messages and logging. > If you catch a broad Exception, you might inadvertently mask other unexpected > errors that should be investigated. > Separate exception handlers make it easier to identify the root cause of an > issue. I'm fine with separate types. You re-throwing any of the exceptions wrapped into `RuntimeException`. From this point of view, a single `Exception` won't change anything: if an exception is thrown, it's caught and re-thrown. These four exceptions are the only checked exceptions that can be thrown, catching `Exception` will catch them either way. Either way is fine with me. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23964#discussion_r1992022959