If a manual test throws an exception during construction of `PassFailJFrame`, 
the test execution hangs. When the builder pattern is used, no UI appears on 
the screens, but the Java process does not terminate automatically because 
there are windows which prevent AWT from shutting down.

**Fix:**

Catch exceptions in `PassFailJFrame.Builder.build()` and dispose of all the 
windows if an exception occurs.

This ensures all the created windows are disposed of, which lets AWT shut down 
cleanly.

_Note:_ the above problem doesn't occur when the test is run with `jtreg` 
because jtreg shuts down the JVM as soon as the main thread exits.

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

Commit messages:
 - 8294155: Exception thrown before awaitAndCheck hangs PassFailJFrame

Changes: https://git.openjdk.org/jdk/pull/23564/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23564&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294155
  Stats: 14 lines in 1 file changed: 12 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/23564.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23564/head:pull/23564

PR: https://git.openjdk.org/jdk/pull/23564

Reply via email to