jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1210098 - /jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
Date Sun, 04 Dec 2011 12:22:22 GMT
Author: pmouawad
Date: Sun Dec  4 12:22:22 2011
New Revision: 1210098

URL: http://svn.apache.org/viewvc?rev=1210098&view=rev
Log:
Use AccessController#doPrivileged to create classloader (Findbugs)

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java?rev=1210098&r1=1210097&r2=1210098&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java Sun Dec  4 12:22:22 2011
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.security.AccessController;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -51,7 +52,7 @@ public final class NewDriver {
     private static final String jmDir;
 
     static {
-        List<URL> jars = new LinkedList<URL>();
+    	final List<URL> jars = new LinkedList<URL>();
         final String initial_classpath = System.getProperty(JAVA_CLASS_PATH);
 
         // Find JMeter home dir from the initial classpath
@@ -122,7 +123,13 @@ public final class NewDriver {
 
         // ClassFinder needs the classpath
         System.setProperty(JAVA_CLASS_PATH, initial_classpath + classpath.toString());
-        loader = new DynamicClassLoader(jars.toArray(new URL[0]));
+        loader = AccessController.doPrivileged(
+        		new java.security.PrivilegedAction<DynamicClassLoader>() {
+        	        public DynamicClassLoader run() {
+        	        	return new DynamicClassLoader(jars.toArray(new URL[0]));
+        	        }
+        	    }
+        );
     }
 
     /**



Mime
View raw message