-
Bug
-
Resolution: Fixed
-
P3
-
6
-
None
-
b53
-
generic
-
generic
There are two issues.
1. The spec for method javax.script.SimpleScriptContext.getAttributesScope(String name) says that method should return -1 if no attribute with the given name is defined in any scope.
In fact, the method returns 0 in this case. Here is an example:
...
final SimpleScriptContext ctx = new SimpleScriptContext();
final String name = getClass().getName() + "#newkey";
System.out.println("Expected: result=-1");
System.out.println("Returned: result=" + ctx.getAttributesScope(name));
...
2. Method getAttributesScope can not find the scope for attribute with the null value. Here is an example:
...
final SimpleScriptContext ctx = new SimpleScriptContext();
final String name = getClass().getName() + "#newkey";
ctx.setAttribute(name, null, ScriptContext.ENGINE_SCOPE);
System.out.println("Expected: result=" + ScriptContext.ENGINE_SCOPE);
System.out.println("Returned: result=" + ctx.getAttributesScope(name));
...
It seems such behavior should be clarified in the spec.
-
1. The spec for method javax.script.SimpleScriptContext.getAttributesScope(String name) says that method should return -1 if no attribute with the given name is defined in any scope.
In fact, the method returns 0 in this case. Here is an example:
...
final SimpleScriptContext ctx = new SimpleScriptContext();
final String name = getClass().getName() + "#newkey";
System.out.println("Expected: result=-1");
System.out.println("Returned: result=" + ctx.getAttributesScope(name));
...
2. Method getAttributesScope can not find the scope for attribute with the null value. Here is an example:
...
final SimpleScriptContext ctx = new SimpleScriptContext();
final String name = getClass().getName() + "#newkey";
ctx.setAttribute(name, null, ScriptContext.ENGINE_SCOPE);
System.out.println("Expected: result=" + ScriptContext.ENGINE_SCOPE);
System.out.println("Returned: result=" + ctx.getAttributesScope(name));
...
It seems such behavior should be clarified in the spec.
-