Details
-
Bug
-
Resolution: Fixed
-
P2
-
8, 9
-
windows
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8177420 | 8u152 | Kevin Rushforth | P2 | Resolved | Fixed | b02 |
JDK-8179698 | 8u141 | Kevin Rushforth | P2 | Closed | Fixed | b08 |
JDK-8177979 | 8u131 | Kevin Rushforth | P2 | Closed | Fixed | b31 |
Description
JavaFX captures the Context Class Loader (CCL) of the calling thread at the time the JavaFX toolkit is initialized, and uses that as the CCL of the JavaFX Application Thread. We then use the CCL to locate user resources, and require it to be non-null in order for those resources to be located. Among these are CSS, FXML, Media, and Image if URIs without a protocol are used.
Starting in JDK 8, JavaFX also references the CCL when loading its own resources, such as loading the default style sheet and looking for embedded fonts, and does so in a way that causes those operations to abort with an NPE when the null CCL is referenced.
The two attached simple test programs illustrate this:
1. NullCCLControlTest -- constructs a Label (any UI control will fail similarly), which will load the default "modena.css" stylesheet
2. NullCCLHTMLEditorTest -- constructs and displays an HTMLEditor, which will load the default "modena.css" stylesheet, and then get a list of all font families.
In JDK 8, both test programs fail with an NPE and display nothing.
In JDK 9, the loading of the CSS resources has been fixed (as part of a larger bug fix for Jigsaw), so creating a Label or other UI control is able to load the stylesheet, but getting the list of font families still fails. So on JDK 9, test program #1 works, while test #2 fails with an NPE when the HTMLEditor tries to popuplate the list of fonts.
-------------------------------------
Original description is below
-------------------------------------
java.lang.ExceptionInInitializerError -
com.sun.javafx.webkit.theme.ScrollBarThemeImpl$1.invalidated(ScrollBarThemeImp
l.java:109)
...
Caused by: java.lang.NullPointerException
at com.sun.javafx.css.StyleManager.getURL(StyleManager.java:860)
The exception stack trace is same as inJDK-8093938
Starting in JDK 8, JavaFX also references the CCL when loading its own resources, such as loading the default style sheet and looking for embedded fonts, and does so in a way that causes those operations to abort with an NPE when the null CCL is referenced.
The two attached simple test programs illustrate this:
1. NullCCLControlTest -- constructs a Label (any UI control will fail similarly), which will load the default "modena.css" stylesheet
2. NullCCLHTMLEditorTest -- constructs and displays an HTMLEditor, which will load the default "modena.css" stylesheet, and then get a list of all font families.
In JDK 8, both test programs fail with an NPE and display nothing.
In JDK 9, the loading of the CSS resources has been fixed (as part of a larger bug fix for Jigsaw), so creating a Label or other UI control is able to load the stylesheet, but getting the list of font families still fails. So on JDK 9, test program #1 works, while test #2 fails with an NPE when the HTMLEditor tries to popuplate the list of fonts.
-------------------------------------
Original description is below
-------------------------------------
java.lang.ExceptionInInitializerError -
com.sun.javafx.webkit.theme.ScrollBarThemeImpl$1.invalidated(ScrollBarThemeImp
l.java:109)
...
Caused by: java.lang.NullPointerException
at com.sun.javafx.css.StyleManager.getURL(StyleManager.java:860)
The exception stack trace is same as in
Attachments
Issue Links
- backported by
-
JDK-8177420 NPE when JavaFX loads default stylesheet or font families if CCL is null
- Resolved
-
JDK-8177979 NPE when JavaFX loads default stylesheet or font families if CCL is null
- Closed
-
JDK-8179698 NPE when JavaFX loads default stylesheet or font families if CCL is null
- Closed
- relates to
-
JDK-8093938 [Mac,CSS] NPE in StyleManager: Thread.currentThread().getContextClassLoader() is null
- Closed