Title: RE: [Bug 543] New - NullPointerException in junit task

Fixed the clone() method, CommandlineJava was calling the clone on a null attribute. (ie classpath)

--
 St�phane Bailliez
 Software Engineer, Paris - France
 iMediation - http://www.imediation.com
 Disclaimer: All the opinions expressed above are mine and not those from my company.



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 07, 2001 7:35 PM
> To: [EMAIL PROTECTED]
> Subject: [Bug 543] New - NullPointerException in junit task
>
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=543
>
> *** shadow/543        Wed Feb  7 10:34:30 2001
> --- shadow/543.tmp.1098       Wed Feb  7 10:34:30 2001
> ***************
> *** 0 ****
> --- 1,94 ----
> +
> +=============================================================
> ===============+
> + | NullPointerException in junit task                       
>                  |
> +
> +-------------------------------------------------------------
> ---------------+
> + |        Bug #: 543                         Product: Ant   
>                  |
> + |       Status: NEW                         Version: 1.3
> Beta 1              |
> + |   Resolution:                            Platform: PC    
>                  |
> + |     Severity: Normal                   OS/Version:
> Windows NT/2K           |
> + |     Priority:                           Component:
> Optional Tasks          |
> +
> +-------------------------------------------------------------
> ---------------+
> + |  Assigned To: [EMAIL PROTECTED]                 
>                  |
> + |  Reported By: [EMAIL PROTECTED]                        
>                  |
> + |      CC list: Cc:                                        
>                  |
> +
> +-------------------------------------------------------------
> ---------------+
> + |          URL:                                            
>                  |
> +
> +=============================================================
> ===============+
> + |                              DESCRIPTION                 
>                  |
> + Using: ant 1.3 beta 1, junit 3.5, jdk 1.3
> +
> + Summary: forked junit task throws a NullPointerException
> for a simple test
> + if you don't specify a classpath element. At the same time
> forked java task
> + using junit.textui.TestRunner works fine.
> +
> + build.xml:
> + ========================================
> + <project name="HelloTest" default="test" basedir="." >
> +
> +     <property name="src.dir" value="src" />
> +     <property name="out.dir" value="out" />
> +     <property name="test.name" value="HelloTest" />
> +
> +     <target name="prepare" >
> +         <mkdir dir="${out.dir}" />
> +     </target>
> +
> +     <target name="compile" depends="prepare" >
> +         <javac srcdir="${src.dir}"
> +                destdir="${out.dir}"
> +         />
> +     </target>
> +
> +     <target name="test" depends="compile" >
> +         <java classname="junit.textui.TestRunner"
> +               fork="true"
> +               dir="${out.dir}" >
> +               <arg line="${test.name}" />
> +         </java>
> +         <junit fork="true"
> +                dir="${out.dir}">
> +                <test name="${test.name}" />
> +         </junit>
> +     </target>
> +
> + </project>
> + ========================================
> +
> + src/HelloTest.java:
> + ========================================
> + import junit.framework.TestCase;
> +
> + public class HelloTest extends TestCase {
> +
> +     public HelloTest(String name) {
> +         super(name);
> +     }
> +
> +     public void test()  {
> +     }
> +
> + }
> + ========================================
> +
> + output:
> + ========================================
> + test:
> +      [java] .
> +      [java] Time: 0
> +      [java]
> +      [java] OK (1 tests)
> +      [java]
> +
> + BUILD FAILED
> +
> + java.lang.NullPointerException
> +         at org.apache.tools.ant.types.CommandlineJava.clone
> + (CommandlineJava.java:242)
> +         at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute
> + (JUnitTask.java:272)
> +         at org.apache.tools.ant.Target.execute(Target.java:153)
> +         at org.apache.tools.ant.Project.runTarget(Project.java:898)
> +         at
> org.apache.tools.ant.Project.executeTarget(Project.java:536)
> +         at
> org.apache.tools.ant.Project.executeTargets(Project.java:510)
> +         at org.apache.tools.ant.Main.runBuild(Main.java:421)
> +         at org.apache.tools.ant.Main.main(Main.java:149)
> + ========================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

 

Attachment: commandlinejava.diff
Description: Binary data

Reply via email to