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

Creating a ContextMenu on the JavaFX-Launcher thread causes an IllegalStateException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8u40
    • 8u40
    • javafx
    • Windows 8.1 (64bit), JDK 8u40-b02 (64bit)

    Description

      This is related to RT-17716. An example application can be seen here:

      https://gist.github.com/ryanjaeb/06932d05eb301c0bc99b

      Run the above example and an IllegalStateException will be thrown. It's caused by the creation of the ContextMenu on the JavaFX-Launcher thread. I've also observed a handful of things that I find confusing...

      1. Using the LauncherImpl.launchApplication(...) call that is commented out in the main method changes the behavior and the example works. I noticed this by fluke and don't understand how it can influence the thread check that's happening.

      2. Wrapping the call to the method that builds the scene in a try / catch block causes more problems and obfuscates the root cause of the issue. A NoClassDefFoundError occurs after the IllegalStateException is caught. This happens after the call to init(), but before the call to start().

      3. Something causes the application to exit silently. What is it and is it intended? I can't seem to handle the error gracefully. Using the above example, I would like the alternate scene with the "Error!" label to be shown.

      Attachments

        Activity

          People

            kcr Kevin Rushforth
            rjaebjfx Ryan Jaeb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: