GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/230

    GROOVY-7150 - Redirection of output in 
javax.script.ScriptEngine.invokeFunction() doesn't work

    Instead of adding `context` and `out` to the engine context this change 
provides access to those in the `groovy.lang.Binding` to the script class.  
This should allow a user to provide their own variables if they wish to 
override the behavior.  The problem was caused because the `out` variable was 
being removed from the context (for cleanup reasons), so the cached 
`MethodClosure` no longer had access to it since it was executed in another 
method after the `eval` call.
    
    I also added another commit to ensure the factory returned by the engine is 
the same factory that created it.  I couldn't see a reason why each engine 
instance should return a new factory.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy GROOVY-7150

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/230.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #230
    
----
commit b40cdf3f86b23b6ce4765676f41e73f01d79a78b
Author: John Wagenleitner <jwagenleit...@apache.org>
Date:   2016-01-01T20:25:37Z

    GROOVY-7150 - Redirection of output in 
javax.script.ScriptEngine.invokeFunction() doesn't work

commit 3515a0f5384a4abfce6811911ca0aff01bfa80e3
Author: John Wagenleitner <jwagenleit...@apache.org>
Date:   2016-01-01T21:15:03Z

    ScriptEngineFactory returned from ScriptEngine should be same factory that 
created engine

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to