Details
-
Bug
-
Resolution: Won't Fix
-
Major
-
None
-
2.5 RC1
-
Java 1.6
-
javascript rhino script jsr223
-
Unknown
-
N/A
-
N/A
-
Description
Example:
{{script language="javascript"}} print('hello') {{/script}}
The macro will fail with:
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function print. (print#8) in print at line number 8 at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110) at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:124) at org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.eval(AbstractJSR223ScriptMacro.java:277)
Though, the "print" and "println" functions appear to be present in the script scope. Dumping all scope objects to the console with
for (thing in this) { java.lang.System.out.println(thing); java.lang.System.out.println(this[thing]); }
shows both functions :
... print sun.org.mozilla.javascript.internal.InterpretedFunction@602dce20 ... println sun.org.mozilla.javascript.internal.InterpretedFunction@6d9c83b2 ...
Attachments
Issue Links
- is related to
-
XCOMMONS-432 Move to Java 7 as minimum version
- Closed