On Wed, 10 Mar 2021 13:19:03 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> Fixing deadlock when calling Application.launch in the FXThread after >> Platform.startup > > tests/system/src/test/java/test/javafx/scene/InitializeJavaFXTest.java line > 65: > >> 63: } catch (Exception e) { >> 64: System.out.println("got exception: " + e); >> 65: e.printStackTrace(); > > You should rethrow the exception in this case, since it indicates an > unexpected error. Better still, you can remove this block and not catch the > Exception in the first place. If I would rethrow it, it would just print it out, it's currently doing. I could save the Exception in a variable, to rethrow it from the other thread, but I think that would be unnecessarily complicated. > tests/system/src/test/java/test/javafx/scene/InitializeJavaFXTest.java line > 53: > >> 51: } >> 52: >> 53: @Test > > All of the test methods should take a timeout parameter: `@Test (timeout = > 15000)` done > tests/system/src/test/java/test/javafx/scene/InitializeJavaFXTest.java line > 56: > >> 54: public void testStartupThenLaunchInFX() throws Exception { >> 55: CountDownLatch latch = new CountDownLatch(1); >> 56: Platform.runLater(() -> { > > I recommend using `Util.runAndWait` since it will propagate exceptions from > the `runLater` lambda to the caller. This significantly simplifies the test! ------------- PR: https://git.openjdk.java.net/jfx/pull/421