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

FXMLLoader sometimes passes a null ClassLoader to ResouceBundle.getBundle.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8
    • javafx
    • None
    • Windows 8.1 64 bit, JDK 8-ea-b111 32 bit.

      When using fx:include's resources attribute, the FXMLLoader can end up passing a null ClassLoader to ResourceBundle which causes a NullPointerException. The following forum post has more information (I'll summarize below):

      https://forums.oracle.com/message/11240449

      According to the JavaDocs for Class.getClassLoader()...

      Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader.

      According to the JavaDocs for ResourceBundle.getBundle(...) a NullPointerException will be thrown if a null ClassLoader is provided.

      http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getClassLoader()
      http://docs.oracle.com/javase/7/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)

      Edit: I can't seem to attach files, so here is a link to a sample app that shows the issue:

      https://dl.dropboxusercontent.com/u/8788282/sample-app.zip

            Unassigned Unassigned
            rjjfx Ryan J (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: