JDK-8245568 : [TEST_BUG] Replace obsolete FXML tests that use Nashorn
  • Type: Bug
  • Component: javafx
  • Sub-Component: fxml
  • Affected Version: openjfx15
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2020-05-21
  • Updated: 2020-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Two of the FXML unit tests use the Nashorn JavaScript engine to test the FXML scripting capability. Nashorn has been deprecated since JDK 11 and has been removed in JDK 15.

When these tests are run with the default JDK 14, they pass, but produce a warning:

test.javafx.fxml.FXMLLoader_ScriptTest > testScriptHandler STANDARD_ERROR
    Warning: Nashorn engine is planned to be removed from a future JDK release

test.javafx.fxml.FXMLLoader_ScriptTest > testExternalScriptHandler STANDARD_ERROR
    Warning: Nashorn engine is planned to be removed from a future JDK release


When running with JDK 15-ea these two tests fail (as expected, since Nashorn is gone).

test.javafx.fxml.FXMLLoader_ScriptTest > testScriptHandler FAILED
    javafx.fxml.LoadException: Page language not specified.
    /C:/Users/kcr/javafx/jfx-kcr/jfx/rt/modules/javafx.fxml/build/resources/test/test/javafx/fxml/script_handler.fxml:35
        at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
        at javafx.fxml/javafx.fxml.FXMLLoader$ScriptElement.processCharacters(FXMLLoader.java:1604)
        at javafx.fxml/javafx.fxml.FXMLLoader.processCharacters(FXMLLoader.java:2855)
        at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
        at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
        at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2439)
        at test.javafx.fxml.FXMLLoader_ScriptTest.testScriptHandler(FXMLLoader_ScriptTest.java:134)

test.javafx.fxml.FXMLLoader_ScriptTest > testExternalScriptHandler FAILED
    javafx.fxml.LoadException: Unable to locate scripting engine for extension js.
    /C:/Users/kcr/javafx/jfx-kcr/jfx/rt/modules/javafx.fxml/build/resources/test/test/javafx/fxml/script_handler_external.fxml:31
        at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
        at javafx.fxml/javafx.fxml.FXMLLoader$ScriptElement.processStartElement(FXMLLoader.java:1544)
        at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2726)
        at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2556)
        at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
        at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2439)
        at test.javafx.fxml.FXMLLoader_ScriptTest.testExternalScriptHandler(FXMLLoader_ScriptTest.java:147)


We should remove these two tests and replace them with a different (custom) javax.script implementation. See the tests added for JDK-8234959 for an example of how this might be done.