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

ScriptEngineFactory.getParameter() should specify NPE for a null key

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 NPEs.

        However the following line executed on Oracle's JDK.

        new ScriptEngineManager().getEngineFactories().forEach(f -> f.getParameter(null));

        will throw

        java.lang.NullPointerException
        at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getParameter(NashornScriptEngineFactory.java:107)

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

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

        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: