Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6
-
None
-
Java, Windows, Linux
Description
The Java code below should return a string "Hello World!". Instead of that it returns an empty string and prints "Hello World!" in the console the application runs. The problem exists only inside functions; texts printed outside functions are redirected properly:
javax.script.ScriptEngineManager manager = new ScriptEngineManager(); javax.script.ScriptEngine engine = manager.getEngineByName("groovy"); StringWriter stdOut = new StringWriter(); engine.getContext().setWriter(new PrintWriter(stdOut)); engine.eval("def myFunction() { print("Hello World!"); }"); Invocable invoker = (Invocable) engine; invoker.invokeFunction("myFunction", new Object[0]); return stdOut.getBuffer().toString();
Attachments
Issue Links
- links to