Browse Source

don't ignore fileset's errorOnMissingDir in <delete>

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1027000 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 14 years ago
parent
commit
6d79f276e8
4 changed files with 24 additions and 1 deletions
  1. +4
    -1
      WHATSNEW
  2. +4
    -0
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  3. +9
    -0
      src/main/org/apache/tools/ant/types/AbstractFileSet.java
  4. +7
    -0
      src/tests/antunit/taskdefs/delete-test.xml

+ 4
- 1
WHATSNEW View File

@@ -164,7 +164,10 @@ Fixed bugs:
* <signjar> would fail if used via its Java API and the File passed
into the setJar method was not "normalized" (i.e. contained ".."
segments).
Bugzilla Report 50081
Bugzilla Report 50081.

* <delete> ignored <fileset>'s errorOnMissingDir attribute
Bugzilla Report 50124.

Other changes:
--------------


+ 4
- 0
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -603,6 +603,10 @@ public class Delete extends MatchingTask {
fs.setProject(getProject());
}
final File fsDir = fs.getDir();
if (!fs.getErrorOnMissingDir() &&
(fsDir == null || !fsDir.exists())) {
continue;
}
if (fsDir == null) {
throw new BuildException(
"File or Resource without directory or file specified");


+ 9
- 0
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -443,6 +443,15 @@ public abstract class AbstractFileSet extends DataType
this.errorOnMissingDir = errorOnMissingDir;
}

/**
* Gets whether an error is/shold be thrown if the base directory
* does not exist.
* @since Ant 1.8.2
*/
public boolean getErrorOnMissingDir() {
return errorOnMissingDir;
}

/**
* Returns the directory scanner needed to access the files to process.
* @return a <code>DirectoryScanner</code> instance.


+ 7
- 0
src/tests/antunit/taskdefs/delete-test.xml View File

@@ -131,4 +131,11 @@
</delete>
<au:assertFileDoesntExist file="${input}/images/foo.jpg"/>
</target>

<target name="testFilesetWithMissingButIgnoredDir"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50124">
<delete>
<fileset dir="${input}/not-there" errorOnMissingDir="false"/>
</delete>
</target>
</project>

Loading…
Cancel
Save