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

The spec for javax.script.ScriptEngineFactory.getProgram() should specify NPEs thrown

XMLWordPrintable

    • b142
    • Verified

      The spec

      http://docs.oracle.com/javase/8/docs/api/javax/script/ScriptEngineFactory.html#getProgram-java.lang.String...-

      doesn't say anything about how null args are treated. However at least Nashorn impl throws NPEs. The spec deserves to be clarified regarding expected behavior.

      The following lines

              new ScriptEngineManager().getEngineFactories().forEach(f -> f.getProgram(null, null));
              new ScriptEngineManager().getEngineFactories().forEach(f -> f.getProgram((String[])null));

      when run on OracleJDK would cause NPEs:

      Exception in thread "main" java.lang.NullPointerException
      at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getProgram(NashornScriptEngineFactory.java:131)


      The following JCK9 tests will fail due to this issue:
      api/javax_script/ScriptEngineFactory/index.html#GetProgram[test_nullArrayPassed]
      api/javax_script/ScriptEngineFactory/index.html#GetProgram[test_nullArrayOfStatements]

            smailar Sharanaprasad Mailar (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: