ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43799] New: - Touch task fails when fileset is empty
Date Tue, 06 Nov 2007 17:23:24 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43799>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43799

           Summary: Touch task fails when fileset is empty
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P3
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: chris.lear@laculine.com


The touch task gives the error "Specify at least one source--a file or resource
collection." when the nested fileset yields no files to touch.

It's a problem because I want to be able to touch files only on certain
conditions. This build.xml snippet has been working fine in ant 1.6.4:

        <touch>
            <fileset dir="web/WEB-INF"
                includesfile="conf/filteredConfigFiles">
                <not>
                    <depend targetdir=".">
                        <mapper type="merge" to="build.properties"/>
                    </depend>
                </not>
            </fileset>
        </touch>


This bug appears to have been introduced in revision 277936, Mon Mar 14 11:45:29
2005 UTC. See the diff here (line 224):

http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java?r1=277936&r2=349637&diff_format=h

I can get it working using this change:

$ svn diff src/main/org/apache/tools/ant/taskdefs/Touch.java 
Index: src/main/org/apache/tools/ant/taskdefs/Touch.java
===================================================================
--- src/main/org/apache/tools/ant/taskdefs/Touch.java   (revision 592480)
+++ src/main/org/apache/tools/ant/taskdefs/Touch.java   (working copy)
@@ -222,7 +222,7 @@
      * @since Ant 1.6.3
      */
     protected synchronized void checkConfiguration() throws BuildException {
-        if (file == null && resources.size() == 0) {
+        if (file == null && resources==null) {
             throw new BuildException("Specify at least one source"
                                    + "--a file or resource collection.");
         }


I'm not sure this is 100% appropriate, but it works for me.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message