-
Bug
-
Resolution: Unresolved
-
P4
-
jfx14
-
x86
-
os_x
A DESCRIPTION OF THE PROBLEM :
When loading a FXML file using the FXMLLoader with a custom classloader, If the FXML contain a ImageView with an image tag, the image is not found, as the Image component use the Application ClassLoader.
I used a custom classloader to load at runtime the fxml file inside jar in a plugabble architecture.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1 - Create a FXML file that display a Image
2 - Create a jar file with the FXML and the image in it.
3 - Create a Custom UrlClassLoader with the jar url.
4 - Create a FXMLLoader instance and call the setClassLoader() with the custom classloader create at step 3
5 - Run the programme
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The FXML file should display the image
ACTUAL -
Programm return NPE
This is due to the L1107 inside javafx.scene.image.Image that get classloader with this instruction :
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
FREQUENCY : always
When loading a FXML file using the FXMLLoader with a custom classloader, If the FXML contain a ImageView with an image tag, the image is not found, as the Image component use the Application ClassLoader.
I used a custom classloader to load at runtime the fxml file inside jar in a plugabble architecture.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1 - Create a FXML file that display a Image
2 - Create a jar file with the FXML and the image in it.
3 - Create a Custom UrlClassLoader with the jar url.
4 - Create a FXMLLoader instance and call the setClassLoader() with the custom classloader create at step 3
5 - Run the programme
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The FXML file should display the image
ACTUAL -
Programm return NPE
This is due to the L1107 inside javafx.scene.image.Image that get classloader with this instruction :
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
FREQUENCY : always