You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/10/25 11:34:00 UTC

svn commit: r1027000 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Delete.java src/main/org/apache/tools/ant/types/AbstractFileSet.java src/tests/antunit/taskdefs/delete-test.xml

Author: bodewig
Date: Mon Oct 25 09:34:00 2010
New Revision: 1027000

URL: http://svn.apache.org/viewvc?rev=1027000&view=rev
Log:
don't ignore fileset's errorOnMissingDir in <delete>

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
    ant/core/trunk/src/tests/antunit/taskdefs/delete-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1027000&r1=1026999&r2=1027000&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Oct 25 09:34:00 2010
@@ -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:
 --------------

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java?rev=1027000&r1=1026999&r2=1027000&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java Mon Oct 25 09:34:00 2010
@@ -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");

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java?rev=1027000&r1=1026999&r2=1027000&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java Mon Oct 25 09:34:00 2010
@@ -444,6 +444,15 @@ public abstract class AbstractFileSet ex
      }
 
     /**
+     * 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.
      */

Modified: ant/core/trunk/src/tests/antunit/taskdefs/delete-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/delete-test.xml?rev=1027000&r1=1026999&r2=1027000&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/delete-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/delete-test.xml Mon Oct 25 09:34:00 2010
@@ -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>