RFR: 8280818: Expand bug8033699.java to iterate over all LaFs

Rajat Mahajan rmahajan at openjdk.org
Wed Mar 12 17:17:05 UTC 2025


On Tue, 11 Mar 2025 22:49:20 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> Added code to Iterates over all installed Look and Feel environments and added related exception handling.
>> 
>> Testing done.
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23964#discussion_r1991949772


More information about the client-libs-dev mailing list