RFR: 8280818: Expand bug8033699.java to iterate over all LaFs
Alexey Ivanov
aivanov at openjdk.org
Wed Mar 12 17:59:59 UTC 2025
On Wed, 12 Mar 2025 17:13:54 GMT, Rajat Mahajan <rmahajan at 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
More information about the client-libs-dev
mailing list