ADDITIONAL SYSTEM INFORMATION :
Ubuntu 18.10 with OpenJFX used through Maven dependency `org.openjfx:javafx-swing`
A DESCRIPTION OF THE PROBLEM :
In order to avoid test failures due to `UnsupportedOperationException` in a headless environment (e.g. Docker based GitLab CI runner) a user might create a `JFXPanel` and catch `UnsupportedOperationException`. If this test is performed the second time, `new JFXPanel()` never returns.
The issue doesn't occur on a desktop system.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run
```
try {
System.out.println("Checking availability of JavaFX for tests");
new JFXPanel();
System.out.println("JavaFX available for tests");
}catch(UnsupportedOperationException ex) {
//`new JFXPanel()` for JavaFX toolkit initialization causes
//`java.lang.UnsupportedOperationException: Unable to open DISPLAY`
//instead of HeadlessException (which is a subclass of
//UnsupportedOperationException)
if("Unable to open DISPLAY".equals(ex.getMessage())) {
System.out.println("UnsupportedOperationException indicates that the test is run on a headless machine, e.g. a CI service");
} else {
throw ex;
}
}
```
in two different test classes.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both statements `new JFXPanel()` ought to throw `UnsupportedOperationException` or the latter to fail with a verbose exception.
ACTUAL -
The second statement never returns.
---------- BEGIN SOURCE ----------
See https://gitlab.com/krichter/javafx-multiple-initialization/tree/jfxpanel for SSCCE and CI results (the master branch contains a solution with `Platform.startup` which can be used in projects using source features <9 and only works in this scenario, but not in other code - I can investigate further if this issue is confirmed and the fix doesn't fix the issue in the other code).
---------- END SOURCE ----------
FREQUENCY : always
Ubuntu 18.10 with OpenJFX used through Maven dependency `org.openjfx:javafx-swing`
A DESCRIPTION OF THE PROBLEM :
In order to avoid test failures due to `UnsupportedOperationException` in a headless environment (e.g. Docker based GitLab CI runner) a user might create a `JFXPanel` and catch `UnsupportedOperationException`. If this test is performed the second time, `new JFXPanel()` never returns.
The issue doesn't occur on a desktop system.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run
```
try {
System.out.println("Checking availability of JavaFX for tests");
new JFXPanel();
System.out.println("JavaFX available for tests");
}catch(UnsupportedOperationException ex) {
//`new JFXPanel()` for JavaFX toolkit initialization causes
//`java.lang.UnsupportedOperationException: Unable to open DISPLAY`
//instead of HeadlessException (which is a subclass of
//UnsupportedOperationException)
if("Unable to open DISPLAY".equals(ex.getMessage())) {
System.out.println("UnsupportedOperationException indicates that the test is run on a headless machine, e.g. a CI service");
} else {
throw ex;
}
}
```
in two different test classes.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both statements `new JFXPanel()` ought to throw `UnsupportedOperationException` or the latter to fail with a verbose exception.
ACTUAL -
The second statement never returns.
---------- BEGIN SOURCE ----------
See https://gitlab.com/krichter/javafx-multiple-initialization/tree/jfxpanel for SSCCE and CI results (the master branch contains a solution with `Platform.startup` which can be used in projects using source features <9 and only works in this scenario, but not in other code - I can investigate further if this issue is confirmed and the fix doesn't fix the issue in the other code).
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8269796 Platform.runLater() can hang forever if Toolkit startup fails
- Open