This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_2_4_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_4_X by this push:
     new 6aed91b  Console, GroovyMain and Groovysh use context class loader
6aed91b is described below

commit 6aed91bed106dcc5ac749a49413d14d6c6da054a
Author: Eric Milles <eric.mil...@thomsonreuters.com>
AuthorDate: Fri Sep 13 12:02:58 2019 -0500

    Console, GroovyMain and Groovysh use context class loader
---
 src/main/groovy/ui/GroovyMain.java                                  | 4 ++--
 subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/groovy/ui/GroovyMain.java 
b/src/main/groovy/ui/GroovyMain.java
index 77df5fe..3df7f4a 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -472,7 +472,7 @@ public class GroovyMain {
      * Process the input files.
      */
     private void processFiles() throws CompilationFailedException, 
IOException, URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new 
GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);
 
         Script s = groovy.parse(getScriptSource(isScriptFile, script));
@@ -592,7 +592,7 @@ public class GroovyMain {
      * Process the standard, single script with args.
      */
     private void processOnce() throws CompilationFailedException, IOException, 
URISyntaxException {
-        GroovyShell groovy = new GroovyShell(conf);
+        GroovyShell groovy = new 
GroovyShell(Thread.currentThread().getContextClassLoader(), conf);
         setupContextClassLoader(groovy);
         groovy.run(getScriptSource(isScriptFile, script), args);
     }
diff --git 
a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy 
b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
index a37dc76..88e721d 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
@@ -200,7 +200,7 @@ options:
         //when starting via main set the look and feel to system
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
 
-        def console = new Console(Console.class.classLoader?.getRootLoader())
+        def console = new Console(Thread.currentThread().contextClassLoader)
         console.useScriptClassLoaderForScriptExecution = true
         console.run()
         if (args.length == 1) console.loadScriptFile(args[0] as File)

Reply via email to