sbailliez    02/02/19 14:34:02

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
  Log:
  Make sure to set the context classloader to the AntClassLoader.
  PR: 5006
  Submitted by: [EMAIL PROTECTED] (Stefano Mancarella)
  
  Revision  Changes    Path
  1.34      +6 -4      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- JUnitTask.java    29 Jan 2002 16:35:46 -0000      1.33
  +++ JUnitTask.java    19 Feb 2002 22:34:02 -0000      1.34
  @@ -141,7 +141,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Gerrit Riessen</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Erik Hatcher</a>
    *
  - * @version $Revision: 1.33 $
  + * @version $Revision: 1.34 $
    *
    * @see JUnitTest
    * @see BatchTest
  @@ -195,7 +195,7 @@
        * Tells this task to set the named property to "true" when there is a 
error in a test.
        * This property is applied on all BatchTest (batchtest) and JUnitTest 
(test),
        * however, it can possibly be overriden by their own properties.
  -     * @param  value  the name of the property to set in the event of an 
error.
  +     * @param  propertyName  the name of the property to set in the event of 
an error.
        */
       public void setErrorProperty(String propertyName) {
           Enumeration enum = allTests();
  @@ -223,7 +223,7 @@
        * Tells this task to set the named property to "true" when there is a 
failure in a test.
        * This property is applied on all BatchTest (batchtest) and JUnitTest 
(test),
        * however, it can possibly be overriden by their own properties.
  -     * @param  value  the name of the property to set in the event of an 
failure.
  +     * @param  propertyName  the name of the property to set in the event of 
an failure.
        */
       public void setFailureProperty(String propertyName) {
           Enumeration enum = allTests();
  @@ -603,9 +603,9 @@
           if (sysProperties != null) {
               sysProperties.setSystem();
           }
  +        AntClassLoader cl = null;
           try {
               log("Using System properties " + System.getProperties(), 
Project.MSG_VERBOSE);
  -            AntClassLoader cl = null;
               Path classpath = commandline.getClasspath();
               if (classpath != null) {
                   cl = new AntClassLoader(null, project, classpath, false);
  @@ -616,6 +616,7 @@
                   cl.addSystemPackageRoot("junit");
                   // will cause trouble in JDK 1.1 if omitted
                   cl.addSystemPackageRoot("org.apache.tools.ant");
  +                cl.setThreadContextLoader();
               }
               runner = new JUnitTestRunner(test, test.getHaltonerror(), 
test.getFiltertrace(), test.getHaltonfailure(), cl);
               if (summary) {
  @@ -646,6 +647,7 @@
               if (sysProperties != null) {
                   sysProperties.restoreSystem();
               }
  +            cl.resetThreadContextLoader();
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to