Browse Source

Print a warning and don't create an output file if there is no input

to <concat>.

PR: 14310
Submitted by:	Gus Heck <gus.heck at olin.edu>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273539 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
ec3031196a
2 changed files with 12 additions and 1 deletions
  1. +3
    -1
      src/etc/testcases/taskdefs/concat.xml
  2. +9
    -0
      src/main/org/apache/tools/ant/taskdefs/Concat.java

+ 3
- 1
src/etc/testcases/taskdefs/concat.xml View File

@@ -35,7 +35,9 @@
<concat destfile="TESTDEST" append="true">
<filelist dir="${basedir}" files="thisfiledoesnotexist"/>
</concat>
<delete file="TESTDEST"/>
<available file="TESTDEST" property="TESTDEST.was.created"/>
<fail message="TESTDEST created for nonexistant files"
if="TESTDEST.was.created"/>
</target>

</project>

+ 9
- 0
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -266,6 +266,9 @@ public class Concat extends Task {
// Concatenate the files.
if (srcFiles != null) {
catFiles(fileSetBase, srcFiles);
} else {
log("Warning: Concat received empty fileset.",
Project.MSG_WARN);
}
}
} finally {
@@ -317,6 +320,12 @@ public class Concat extends Task {
}

final int len = inputFileNames.size();
if (len == 0) {
log("Warning: Could not find any of the files specified " +
"in concat task.", Project.MSG_WARN);
return;
}

String[] input = new String[len];
inputFileNames.copyInto(input);



Loading…
Cancel
Save