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

FXML: The error returned when the FXML file is not found is not really clear.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7u6
    • fx2.1
    • javafx
    • None

      Considered the attached sample. I have misspelled "title-pane.fxml" into "titled-pane.fxml".

      When running the sample, we get this stack:

      Feb 21, 2012 9:07:00 PM loadfxml.Main start
      SEVERE: null
      java.lang.IllegalStateException: Location is not set.
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:1891)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2484)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2476)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2470)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2464)
      at loadfxml.Main.start(Main.java:37)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)

      Something saying "File Not Found" might have been more appropriate.
      Hmmm... now that I think on it maybe getResource() was returning null, which would explain the "Location is not set" message.
      In that case maybe the best would be for the FXMLLoader.load(...) method to throw a NullPointerException when its first argument is null?

            gkbrown Greg Brown (Inactive)
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: