You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by mb...@apache.org on 2007/11/06 19:30:37 UTC

svn commit: r592515 - in /ant/core/branches/ANT_17_BRANCH/src: main/org/apache/tools/ant/taskdefs/Touch.java tests/antunit/taskdefs/touch-test.xml

Author: mbenson
Date: Tue Nov  6 10:30:37 2007
New Revision: 592515

URL: http://svn.apache.org/viewvc?rev=592515&view=rev
Log:
merge

Added:
    ant/core/branches/ANT_17_BRANCH/src/tests/antunit/taskdefs/touch-test.xml
      - copied unchanged from r592498, ant/core/trunk/src/tests/antunit/taskdefs/touch-test.xml
Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/Touch.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/Touch.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/Touch.java?rev=592515&r1=592514&r2=592515&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/Touch.java (original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/Touch.java Tue Nov  6 10:30:37 2007
@@ -15,7 +15,6 @@
  *  limitations under the License.
  *
  */
-
 package org.apache.tools.ant.taskdefs;
 
 import java.io.File;
@@ -85,7 +84,7 @@
     private long millis = -1;
     private String dateTime;
     private Vector filesets = new Vector();
-    private Union resources = new Union();
+    private Union resources;
     private boolean dateTimeConfigured;
     private boolean mkdirs;
     private boolean verbose = true;
@@ -212,7 +211,8 @@
      * @param rc the collection to add.
      * @since Ant 1.7
      */
-    public void add(ResourceCollection rc) {
+    public synchronized void add(ResourceCollection rc) {
+        resources = resources == null ? new Union() : resources;
         resources.add(rc);
     }
 
@@ -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.");
         }
@@ -285,6 +285,9 @@
         if (file != null) {
             touch(new FileResource(file.getParentFile(), file.getName()),
                   defaultTimestamp);
+        }
+        if (resources == null) {
+            return;
         }
         // deal with the resource collections
         Iterator iter = resources.iterator();



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