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

NashornScriptEngineFactory.getParameter() throws IAE for an unknown key, doesn't conform to the general spec

XMLWordPrintable

        The spec
        http://docs.oracle.com/javase/8/docs/api/javax/script/ScriptEngineFactory.html#getParameter-java.lang.String-
        says:
        "Returns null if no value is assigned to the key."
        and doesn't mention any IAEs.

        However the following line executed on Oracle's JDK.

        new ScriptEngineManager().getEngineFactories().forEach(f -> f.getParameter("no value assigned to this key"));

        will throw

        java.lang.IllegalArgumentException: Invalid key
        at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getParameter(NashornScriptEngineFactory.java:123)

        which doesn't conform to the current spec and the corresponding JCK9(b05) test will fail on JDK9:

        api/javax_script/ScriptEngineFactory/index.html#GetParameter[noValue]

        The specification or the Nashorn implementation needs to be corrected.


              sundar Sundararajan Athijegannathan
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: