maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r349813 - in /maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire: IsolatedClassLoader.java SurefireBooter.java
Date Tue, 29 Nov 2005 21:14:35 GMT
Author: jdcasey
Date: Tue Nov 29 13:14:30 2005
New Revision: 349813

URL: http://svn.apache.org/viewcvs?rev=349813&view=rev
Log:
PR: MNG-1303
Submitted By: John Casey

Commented out the loadClass(..) method in IsolatedClassLoader, and added a new constructor
that allows the user to define a parent classloader. Then, the surefire booter includes ClassLoader.getSystemClassLoader()
as the parent to the isolated classloader it creates for testing...

NOTE: This may break some things, since the loadClass(..) method in IsolatedClassLoader reversed
the normal parent-first loading strategy. I'm committing it so Jason can take a look, since
he wrote the IsolatedClassLoader (or at least committed it).


Modified:
    maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/IsolatedClassLoader.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/SurefireBooter.java

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/IsolatedClassLoader.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/IsolatedClassLoader.java?rev=349813&r1=349812&r2=349813&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/IsolatedClassLoader.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/IsolatedClassLoader.java
Tue Nov 29 13:14:30 2005
@@ -16,12 +16,10 @@
  * limitations under the License.
  */
 
-import java.net.URLClassLoader;
 import java.net.URL;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
+import java.net.URLClassLoader;
 import java.util.HashSet;
+import java.util.Set;
 
 public class IsolatedClassLoader
     extends URLClassLoader
@@ -35,6 +33,11 @@
         super( new URL[0], null );
     }
 
+    public IsolatedClassLoader( ClassLoader parent )
+    {
+        super( new URL[0], parent );
+    }
+
     public void addURL( URL url )
     {
         if ( !urls.contains( url ) )
@@ -47,35 +50,35 @@
         }
     }
 
-    public synchronized Class loadClass( String className )
-        throws ClassNotFoundException
-    {
-        Class c = findLoadedClass( className );
-
-        ClassNotFoundException ex = null;
-
-        if ( c == null )
-        {
-            try
-            {
-                c = findClass( className );
-            }
-            catch ( ClassNotFoundException e )
-            {
-                ex = e;
-
-                if ( parent != null )
-                {
-                    c = parent.loadClass( className );
-                }
-            }
-        }
-
-        if ( c == null )
-        {
-            throw ex;
-        }
-
-        return c;
-    }
+//    public synchronized Class loadClass( String className )
+//        throws ClassNotFoundException
+//    {
+//        Class c = findLoadedClass( className );
+//
+//        ClassNotFoundException ex = null;
+//
+//        if ( c == null )
+//        {
+//            try
+//            {
+//                c = findClass( className );
+//            }
+//            catch ( ClassNotFoundException e )
+//            {
+//                ex = e;
+//
+//                if ( parent != null )
+//                {
+//                    c = parent.loadClass( className );
+//                }
+//            }
+//        }
+//
+//        if ( c == null )
+//        {
+//            throw ex;
+//        }
+//
+//        return c;
+//    }
 }

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/SurefireBooter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/SurefireBooter.java?rev=349813&r1=349812&r2=349813&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/SurefireBooter.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/codehaus/surefire/SurefireBooter.java
Tue Nov 29 13:14:30 2005
@@ -75,7 +75,9 @@
     public boolean run()
         throws Exception
     {
-        IsolatedClassLoader surefireClassLoader = new IsolatedClassLoader();
+        ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
+
+        IsolatedClassLoader surefireClassLoader = new IsolatedClassLoader( systemLoader );
 
         for ( Iterator i = classpathUrls.iterator(); i.hasNext(); )
         {



Mime
View raw message