Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8240979

Image component should use the same classloader used by FXMLLoader

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      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


        Attachments

          Activity

            People

            • Assignee:
              kcr Kevin Rushforth
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: