RFR: 8284993: Replace System.exit call in swing tests with RuntimeException [v3]

Phil Race prr at openjdk.java.net
Wed Apr 20 19:38:25 UTC 2022


On Wed, 20 Apr 2022 10:46:01 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Few swing tests call System.exit() which might stop the test harness from executing further tests if any of the test fail. We should replace with RuntimeException.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Test fix

test/jdk/javax/swing/JComboBox/8019180/Test8019180.java line 74:

> 72:                 if (0 > this.test.getSelectedIndex()) {
> 73:                     System.err.println("ERROR: no selection");
> 74:                     throw new RuntimeException("Combobox not selected");

So this is relying on jtreg to catch exceptions not handled by a thread ?
Wouldn't it be better to flag the failure and have it thrown by the main thread ?

BTW since all the client tests are run in othervm mode, System.exit() isn't a real problem but it is still fine to fix this.

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

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



More information about the client-libs-dev mailing list