From 04fc803b0e1f8fed295dbff73c77b192f23392bc Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 4 Nov 2014 15:03:46 -0700 Subject: [PATCH] 448446 - org.eclipse.jetty.start.Main create classloader duplicate + Reuse ClassLoader instead. --- .../src/main/java/org/eclipse/jetty/start/Main.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 6c988867072..eca1f7929fc 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -289,10 +289,9 @@ public class Main return ""; } - public void invokeMain(StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException + public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException { Class invoked_class = null; - ClassLoader classloader = args.getClasspath().getClassLoader(); String mainclass = args.getMainClassname(); try @@ -317,8 +316,7 @@ public class Main { argArray.getClass() }; Method main = invoked_class.getDeclaredMethod("main",method_param_types); - Object[] method_params = new Object[] - { argArray }; + Object[] method_params = new Object[] { argArray }; StartLog.endStartLog(); main.invoke(null,method_params); } @@ -810,14 +808,13 @@ public class Main System.err.println("WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec"); } - // Set current context class loader to what is selected. ClassLoader cl = classpath.getClassLoader(); Thread.currentThread().setContextClassLoader(cl); // Invoke the Main Class try { - invokeMain(args); + invokeMain(cl, args); } catch (Exception e) {