You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was not able to duplicate the NullPointerException (a stack trace would be helpful here).
Actually, I did manage to produce a NullPointerException by running the above as Groovy, with a fully qualified javax.script.ScriptEngineManager, but the stack trace is:
java.lang.NullPointerException: Cannot get property 'getContext' on null object
at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at Script25.run(Script25.groovy:1)
So I'm guessing the problem is not actually related to the containsKey call, which never occurs, but rather than use of getContext.
Here is a Groovy script which gets farther, but certainly still demonstrates some weirdness:
#@ ScriptService ss
clojure = ss.getLanguageByName("clojure")
println("Found Clojure language: "+ clojure.getClass().getName())
bindings = clojure.getScriptEngine().getBindings(javax.script.ScriptContext.ENGINE_SCOPE)
// output all the keysprintln("Bindings has "+ bindings.keySet().size() +" key-pairs:");
for (key in bindings.keySet()) {
println("\t"+ key +" = "+ bindings.get(key))
}
// check for specific containmentdefcontains(key) {
println("contains "+ key +"? "+ bindings.containsKey(key))
}
contains("context")
contains("ui")
contains("asdf")
On my system, it produces:
Found Clojure language: org.scijava.plugins.scripting.clojure.ClojureScriptLanguage
Bindings has 0 key-pairs:
contains context? true
contains ui? true
contains asdf? true
If no variable called
ten
is defined, the following Scala code throwsjava.lang.NullPointerException
:Similar code works for
scripting-scala
. However, this bug can is also present forscripting-java
The text was updated successfully, but these errors were encountered: