ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java
Date Sat, 16 Jul 2005 12:23:48 GMT
jkf         2005/07/16 05:23:48

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
  Log:
  PR: 35750
  
  Make sure the classLoader is always cleaned up before getting a  new one.
  
  Revision  Changes    Path
  1.119     +16 -8     ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- JUnitTask.java	8 Jul 2005 13:46:38 -0000	1.118
  +++ JUnitTask.java	16 Jul 2005 12:23:48 -0000	1.119
  @@ -671,10 +671,7 @@
                   }
               }
           } finally {
  -            if (classLoader != null && reloading) {
  -                classLoader.cleanup();
  -            }
  -            classLoader = null;
  +            deleteClassLoader();
           }
       }
   
  @@ -1112,9 +1109,6 @@
               }
               if (classLoader != null) {
                   classLoader.resetThreadContextLoader();
  -                if (!reloading) {
  -                    classLoader.cleanup();
  -                }
               }
           }
       }
  @@ -1273,7 +1267,7 @@
        */
       private void logVmExit(FormatterElement[] feArray, JUnitTest test,
                              String message) {
  -        createClassLoader();
  +        createClassLoader();  
           test.setCounts(1, 0, 1);
           test.setProperties(getProject().getProperties());
           for (int i = 0; i < feArray.length; i++) {
  @@ -1330,6 +1324,7 @@
           Path userClasspath = getCommandline().getClasspath();
           if (userClasspath != null) {
               if (reloading || classLoader == null) {
  +                deleteClassLoader();
                   Path classpath = (Path) userClasspath.clone();
                   if (includeAntRuntime) {
                       log("Implicitly adding " + antRuntimeClasses
  @@ -1352,6 +1347,19 @@
               }
           }
       }
  +    
  +    /**
  +     * Removes a classloader if needed.
  +     * @since Ant 1.7
  +     */
  +    private void deleteClassLoader()
  +    {
  +        if (classLoader != null)
  +        {
  +            classLoader.cleanup();
  +            classLoader = null;
  +        }
  +    }
   
       /**
        * @since Ant 1.6.2
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message