bodewig 2002/11/08 05:20:10
Modified: . Tag: ANT_15_BRANCH WHATSNEW
src/etc/testcases/taskdefs Tag: ANT_15_BRANCH concat.xml
src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Concat.java
src/testcases/org/apache/tools/ant/taskdefs Tag:
ANT_15_BRANCH ConcatTest.java
Log:
Merge fix for PR14310 from HEAD
Revision Changes Path
No revision
No revision
1.263.2.95 +2 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.94
retrieving revision 1.263.2.95
diff -u -r1.263.2.94 -r1.263.2.95
--- WHATSNEW 7 Nov 2002 15:17:51 -0000 1.263.2.94
+++ WHATSNEW 8 Nov 2002 13:20:10 -0000 1.263.2.95
@@ -21,6 +21,8 @@
* <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.
Changes from Ant 1.5.1Beta1 to 1.5.1
====================================
No revision
No revision
1.1.2.1 +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.1.2.1
diff -u -r1.1 -r1.1.2.1
--- concat.xml 2 Apr 2002 14:03:05 -0000 1.1
+++ concat.xml 8 Nov 2002 13:20:10 -0000 1.1.2.1
@@ -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>
No revision
No revision
1.5.2.2 +15 -11
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.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- Concat.java 19 Jun 2002 00:42:43 -0000 1.5.2.1
+++ Concat.java 8 Nov 2002 13:20:10 -0000 1.5.2.2
@@ -109,7 +109,8 @@
private File destinationFile = null;
/**
- * If the destination file exists, should the stream be appended?
+ * Whether or not the stream should be appended if the destination file
+ * exists.
* Defaults to <code>false</code>.
*/
private boolean append = false;
@@ -246,10 +247,10 @@
// determine the files from the set which need to be
// concatenated.
DirectoryScanner scanner =
- fileSet.getDirectoryScanner(project);
+ fileSet.getDirectoryScanner(getProject());
// Determine the root path.
- fileSetBase = fileSet.getDir(project);
+ fileSetBase = fileSet.getDir(getProject());
// Get the list of files.
srcFiles = scanner.getIncludedFiles();
@@ -259,10 +260,10 @@
FileList fileList = (FileList) next;
// Determine the root path.
- fileSetBase = fileList.getDir(project);
+ fileSetBase = fileList.getDir(getProject());
// Get the list of files.
- srcFiles = fileList.getFiles(project);
+ srcFiles = fileList.getFiles(getProject());
}
@@ -301,9 +302,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]);
@@ -317,9 +317,13 @@
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) {
OutputStream os = null;
@@ -455,8 +459,8 @@
String text = textBuffer.toString();
// Replace ${property} strings.
- text = ProjectHelper.replaceProperties(project, text,
- project.getProperties());
+ text = ProjectHelper.replaceProperties(getProject(), text,
+ getProject().getProperties());
// Set up a writer if necessary.
FileWriter writer = null;
No revision
No revision
1.1.2.1 +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.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ConcatTest.java 2 Apr 2002 14:03:05 -0000 1.1
+++ ConcatTest.java 8 Nov 2002 13:20:10 -0000 1.1.2.1
@@ -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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>