Skip to content

Commit a32fa84

Browse files
committed
8294155: Exception thrown before awaitAndCheck hangs PassFailJFrame
Backport-of: 906358d3a14ce755fec771f0a6bb856b3a8f3297
1 parent 23a44d9 commit a32fa84

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/jdk/java/awt/regtesthelpers/PassFailJFrame.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,20 @@ public Builder position(Position position) {
17871787

17881788
public PassFailJFrame build() throws InterruptedException,
17891789
InvocationTargetException {
1790-
validate();
1791-
return new PassFailJFrame(this);
1790+
try {
1791+
validate();
1792+
return new PassFailJFrame(this);
1793+
} catch (final Throwable t) {
1794+
// Dispose of all the windows, including those that may not
1795+
// be registered with PassFailJFrame to allow AWT to shut down
1796+
try {
1797+
invokeOnEDT(() -> Arrays.stream(Window.getWindows())
1798+
.forEach(Window::dispose));
1799+
} catch (Throwable edt) {
1800+
t.addSuppressed(edt);
1801+
}
1802+
throw t;
1803+
}
17921804
}
17931805

17941806
/**

0 commit comments

Comments
 (0)