You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2004/12/07 11:29:32 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

peterreilly    2004/12/07 02:29:32

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
  Log:
  If junittask is loaded by a different classloader than the
  project classloader, set the junittask classloader as the
  parent of the classloader used to load the tests, otherwise
  the tests will not see the classes in ant-junit.jar and the
  classes loaded with the tests will use a different junit.jar
  than the junit used by junittask and will be not be compatible.
  PR: 28474
  
  Revision  Changes    Path
  1.692     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.691
  retrieving revision 1.692
  diff -u -r1.691 -r1.692
  --- WHATSNEW	1 Dec 2004 13:45:48 -0000	1.691
  +++ WHATSNEW	7 Dec 2004 10:29:32 -0000	1.692
  @@ -171,6 +171,9 @@
   * Target location is not set for default target.
     Bugzilla report 32267.
   
  +* Incorrect classloader parent in junittask when using with ant-junit.jar and junit.jar
  +  not in the project classloader. Bugzilla report 28474.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  
  1.112     +5 -1      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.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- JUnitTask.java	22 Nov 2004 09:23:34 -0000	1.111
  +++ JUnitTask.java	7 Dec 2004 10:29:32 -0000	1.112
  @@ -1321,6 +1321,10 @@
                       classpath.append(antRuntimeClasses);
                   }
                   classLoader = getProject().createClassLoader(classpath);
  +                if (getClass().getClassLoader() != null
  +                    && getClass().getClassLoader() != Project.class.getClassLoader()) {
  +                    classLoader.setParent(getClass().getClassLoader());
  +                }
                   classLoader.setParentFirst(false);
                   classLoader.addJavaLibraries();
                   log("Using CLASSPATH " + classLoader.getClasspath(),
  
  
  

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