-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b66
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084935 | emb-9 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | team |
JDK-8086920 | 8u65 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | b01 |
JDK-8080606 | 8u60 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | b18 |
JDK-8138144 | emb-8u65 | Unassigned | P3 | Resolved | Fixed | b01 |
JDK-8086200 | emb-8u60 | Sundararajan Athijegannathan | P3 | Resolved | Fixed | team |
http://docs.oracle.com/javase/8/docs/api/javax/script/ScriptContext.html
asserts plenty of IAE/NPE exception throwing for getter/setter methods, however this is not completely fulfilled by the instance of SimpleScriptContext used by NashornScriptEngine
The problem shows up with GLOBAL_SCOPE.
Please try the sample which represents the JCK conformance test which operates with all the available script engine on an abstract level - without any assumption that the Nashorn engine is present or not on the certified system.
The following code throws no exceptions with JDK9b48:
import javax.script.*;
public class Test {
public static void main(String[] args) {
for (ScriptEngineFactory f : new ScriptEngineManager().getEngineFactories()) {
ScriptEngine e = f.getScriptEngine();
ScriptContext c = e.getContext();
System.err.println("context: " + c);
System.err.println("engine: " + e);
c.getAttribute("", ScriptContext.GLOBAL_SCOPE);
c.getAttribute(null, ScriptContext.GLOBAL_SCOPE);
c.removeAttribute(null, ScriptContext.GLOBAL_SCOPE);
c.removeAttribute("", ScriptContext.GLOBAL_SCOPE);
c.setAttribute("", "value", ScriptContext.GLOBAL_SCOPE);
c.setAttribute(null, "value", ScriptContext.GLOBAL_SCOPE);
}
}
}
The output would be like
context: javax.script.SimpleScriptContext@19afc07
engine: jdk.nashorn.api.scripting.NashornScriptEngine@2db087
The problem (no exceptions thrown) is perfectly reproducible with just SimpleScriptContext instance:
new SimpleScriptContext().getAttribute("", ScriptContext.GLOBAL_SCOPE);
new SimpleScriptContext().getAttribute(null, ScriptContext.GLOBAL_SCOPE);
new SimpleScriptContext().removeAttribute(null, ScriptContext.GLOBAL_SCOPE);
new SimpleScriptContext().removeAttribute("", ScriptContext.GLOBAL_SCOPE);
new SimpleScriptContext().setAttribute("", "value", ScriptContext.GLOBAL_SCOPE);
new SimpleScriptContext().setAttribute(null, "value", ScriptContext.GLOBAL_SCOPE);
The list of failing JCK9 tests:
api/javax_script/ScriptContext/index.html#Exceptions[getAttribute_IAE_emptyName]
api/javax_script/ScriptContext/index.html#Exceptions[getAttribute_NPE]
api/javax_script/ScriptContext/index.html#Exceptions[removeAttribute_IAE_emptyName]
api/javax_script/ScriptContext/index.html#Exceptions[removeAttribute_NPE]
api/javax_script/ScriptContext/index.html#Exceptions[setAttribute_IAE_emptyName]
api/javax_script/ScriptContext/index.html#Exceptions[setAttribute_NPE]
api/javax_script/SimpleScriptContext/index.html#Exceptions[getAttribute_IAE_emptyName]
api/javax_script/SimpleScriptContext/index.html#Exceptions[getAttribute_NPE]
api/javax_script/SimpleScriptContext/index.html#Exceptions[removeAttribute_IAE_emptyName]
api/javax_script/SimpleScriptContext/index.html#Exceptions[removeAttribute_NPE]
api/javax_script/SimpleScriptContext/index.html#Exceptions[setAttribute_IAE_emptyName]
api/javax_script/SimpleScriptContext/index.html#Exceptions[setAttribute_NPE]
- backported by
-
JDK-8080606 SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
-
- Resolved
-
-
JDK-8084935 SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
-
- Resolved
-
-
JDK-8086200 SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
-
- Resolved
-
-
JDK-8086920 SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
-
- Resolved
-
-
JDK-8138144 SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
-
- Resolved
-
- relates to
-
JDK-8071594 NashornScriptEngine returns javax.script.ScriptContext instance which doesn't completely conform to the spec regarding exceptions throwing
-
- Closed
-