Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-5
-
None
-
None
-
Gentoo Linux, Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Description
Both GroovyEngine and CachingGroovyEngine use thread context ClassLoader as parent ClassLoader instead of BSFManager.getClassLoader().
GroovyClassLoader also always uses system 'java.class.path' property and gives no respect to BSFManager.getClassPath().
Here is proposed patch to fix the first issue. Looks like second issue requires minor design changes.
diff -r orig/org/codehaus/groovy/bsf/CachingGroovyEngine.java patched/org/codehaus/groovy/bsf/CachingGroovyEngine.java
123c123
< parent = Thread.currentThread().getContextClassLoader();
—
> parent = mgr.getClassLoader();
diff -r orig/org/codehaus/groovy/bsf/GroovyEngine.java patched/org/codehaus/groovy/bsf/GroovyEngine.java
47a48
> import groovy.lang.Binding;
178c179
< shell = new GroovyShell();
—
> shell = new GroovyShell(mgr.getClassLoader(), new Binding());