Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-475

BSF integration doesn't use BSFManager's class loader

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-beta-6
    • 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());

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            kos Konstantin Nikolaev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: