ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs ConcatTest.java
Date Fri, 08 Nov 2002 13:10:23 GMT
bodewig     2002/11/08 05:10:22

  Modified:    .        WHATSNEW
               src/etc/testcases/taskdefs concat.xml
               src/main/org/apache/tools/ant/taskdefs Concat.java
               src/testcases/org/apache/tools/ant/taskdefs ConcatTest.java
  Log:
  Fix NPE in <concat>.
  
  PR: 14310
  
  Revision  Changes    Path
  1.313     +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.312
  retrieving revision 1.313
  diff -u -r1.312 -r1.313
  --- WHATSNEW	7 Nov 2002 16:26:18 -0000	1.312
  +++ WHATSNEW	8 Nov 2002 13:10:22 -0000	1.313
  @@ -42,6 +42,9 @@
   * <replace> would count some internal character replacements when
     reporting the number of replaced tokens.
   
  +* <concat> would cause an exception if a <filelist> pointed to files
  +  that do not exist.
  +
   Other changes:
   --------------
   
  
  
  
  1.2       +6 -0      jakarta-ant/src/etc/testcases/taskdefs/concat.xml
  
  Index: concat.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/concat.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- concat.xml	2 Apr 2002 14:03:05 -0000	1.1
  +++ concat.xml	8 Nov 2002 13:10:22 -0000	1.2
  @@ -31,4 +31,10 @@
       <concat>Hello, ${world}!</concat>
     </target>
   
  +  <target name="test6">
  +    <concat destfile="TESTDEST" append="true">
  +      <filelist dir="${basedir}" files="thisfiledoesnotexist"/>
  +    </concat>
  +  </target>
  +
   </project>
  
  
  
  1.10      +7 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Concat.java
  
  Index: Concat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Concat.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Concat.java	25 Jul 2002 15:21:04 -0000	1.9
  +++ Concat.java	8 Nov 2002 13:10:22 -0000	1.10
  @@ -298,9 +298,8 @@
       private void catFiles(File base, String[] files) {
   
           // First, create a list of absolute paths for the input files.
  -        final int len = files.length;
  -        String[] input = new String[len];
  -        for (int i = 0; i < len; i++) {
  +        Vector inputFileNames = new Vector();
  +        for (int i = 0; i < files.length; i++) {
   
               File current = new File(base, files[i]);
   
  @@ -314,8 +313,12 @@
                   continue;
               }
   
  -            input[i] = current.getAbsolutePath();
  +            inputFileNames.addElement(current.getAbsolutePath());
           }
  +
  +        final int len = inputFileNames.size();
  +        String[] input = new String[len];
  +        inputFileNames.copyInto(input);
   
           // Next, perform the concatenation.
           if (encoding == null) {
  
  
  
  1.2       +5 -0      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ConcatTest.java
  
  Index: ConcatTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ConcatTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConcatTest.java	2 Apr 2002 14:03:05 -0000	1.1
  +++ ConcatTest.java	8 Nov 2002 13:10:22 -0000	1.2
  @@ -161,4 +161,9 @@
           expectLog("test5", "Hello, World!");
       }
   
  +    public void test6() {
  +        expectLogContaining("test6", 
  +                            "src/etc/testcases/taskdefs/thisfiledoesnotexist does not exist.");
  +    }
  +
   }
  
  
  

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


Mime
View raw message