ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs JarTest.java
Date Wed, 26 Feb 2003 09:57:01 GMT
bodewig     2003/02/26 01:57:01

  Modified:    src/etc/testcases/taskdefs jar.xml
               src/main/org/apache/tools/ant/taskdefs Zip.java
               src/testcases/org/apache/tools/ant/taskdefs JarTest.java
  Log:
  Avoid NPE in <zip> and friends for empty <fileset>s.
  
  Submitted by:	Nico Seessle <nico at apache dot org>
  
  Revision  Changes    Path
  1.9       +21 -0     ant/src/etc/testcases/taskdefs/jar.xml
  
  Index: jar.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/jar.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jar.xml	23 Jan 2003 15:03:28 -0000	1.8
  +++ jar.xml	26 Feb 2003 09:57:01 -0000	1.9
  @@ -5,6 +5,8 @@
     <property name="tmp.jar" location="tmp.jar"/>
     <property name="tmp.dir" location="jartmp"/>
     <property name="tmp.zip" location="tmp.zip"/>
  +  <property name="tmp1.dir" location="jartmp1"/>
  +  <property name="tmp2.dir" location="jartmp2"/>
   
     <target name="test1">
       <jar/>
  @@ -166,6 +168,25 @@
       <delete file="${tmp.jar}" />
       <delete dir="${tmp.dir}"/>
       <delete file="${tmp.zip}" />
  +    <delete dir="${tmp1.dir}"/>
  +    <delete dir="${tmp2.dir}"/>
  +  </target>
  +
  +  <target name="testCreateWithEmptyFilesetSetUp">
  +    <mkdir dir="${tmp1.dir}"/>
  +    <mkdir dir="${tmp2.dir}"/>
  +    <echo file="${tmp2.dir}/foo.txt" message="foo"/>
  +  </target>
  +
  +  <target name="testCreateWithEmptyFileset">
  +    <jar destfile="${tmp.jar}">
  +      <fileset dir="${tmp1.dir}">
  +        <include name="**/*.doesNotExist"/>
  +      </fileset>
  +      <fileset dir="${tmp2.dir}">
  +        <include name="**/foo.txt"/>
  +      </fileset>
  +    </jar>
     </target>
   
   </project>
  
  
  
  1.98      +1 -0      ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- Zip.java	19 Feb 2003 07:57:29 -0000	1.97
  +++ Zip.java	26 Feb 2003 09:57:01 -0000	1.98
  @@ -750,6 +750,7 @@
   
           for (int i = 0; i < filesets.length; i++) {
               if (initialResources[i].length == 0) {
  +                newerResources[i] = new Resource[] {};
                   continue;
               }
               
  
  
  
  1.18      +5 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java
  
  Index: JarTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- JarTest.java	20 Feb 2003 17:15:46 -0000	1.17
  +++ JarTest.java	26 Feb 2003 09:57:01 -0000	1.18
  @@ -214,4 +214,9 @@
                        "testRecreateZipfilesetWithUpdateNewerFile");
       }
   
  +    public void testCreateWithEmptyFileset() {
  +        executeTarget("testCreateWithEmptyFilesetSetUp");
  +        executeTarget("testCreateWithEmptyFileset");
  +        executeTarget("testCreateWithEmptyFileset");
  +    }
   }
  
  
  

Mime
View raw message