Skip to content

Commit f66fff5

Browse files
committed
Review comment + OutputRedirect
1 parent f08b741 commit f66fff5

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassScene.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ final SceneState getSceneState() {
250250

251251
final void updateSceneState() {
252252
// should only be called on the event thread
253-
if (getSceneState() != null) {
253+
if (sceneState != null) {
254254
sceneState.update();
255255
}
256256
}

tests/system/src/test/java/test/javafx/embed/swing/JFXPanelNPETest.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.junit.jupiter.api.BeforeAll;
4444
import org.junit.jupiter.api.Test;
4545

46+
import test.javafx.util.OutputRedirect;
4647
import test.util.Util;
4748

4849
public class JFXPanelNPETest {
@@ -86,23 +87,19 @@ public void doCleanup() {
8687

8788
@Test
8889
public void testSceneNPE() throws Exception {
89-
failure = new AtomicBoolean(false);
90-
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
91-
@Override
92-
public void uncaughtException(Thread t, Throwable e) {
93-
e.printStackTrace();
94-
failure.set(true);
90+
OutputRedirect.suppressStderr();
91+
try {
92+
SwingUtilities.invokeAndWait(JFXPanelNPETest::createUI);
93+
for (int i = 0; i < 300; i++) {
94+
SwingUtilities.invokeLater(contentPane::repaint);
95+
Platform.runLater(() -> contentPane.setScene(null));
96+
Thread.sleep(1);
97+
Platform.runLater(() -> contentPane.setScene(webView.getScene()));
98+
Thread.sleep(1);
9599
}
96-
});
97-
SwingUtilities.invokeAndWait(JFXPanelNPETest::createUI);
98-
for (int i = 0; i < 300; i++) {
99-
SwingUtilities.invokeLater(contentPane::repaint);
100-
Platform.runLater(() -> contentPane.setScene(null));
101-
Thread.sleep(1);
102-
Platform.runLater(() -> contentPane.setScene(webView.getScene()));
103-
Thread.sleep(1);
100+
} finally {
101+
OutputRedirect.checkAndRestoreStderr();
104102
}
105-
Assertions.assertFalse(failure.get());
106103
}
107104

108105
protected static void createUI() {
@@ -122,4 +119,3 @@ private static void fx(final JFXPanel contentPane) {
122119
contentPane.setScene(new Scene(webView));
123120
}
124121
}
125-

0 commit comments

Comments
 (0)