From c6a2ce5a054f4985d68689f9dff61e43a65a1c23 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 6 Oct 2005 03:50:30 +0000 Subject: [PATCH] empty collection != no collection git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@306520 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 89a53f49b..e20ce186d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -57,7 +57,7 @@ public class ExecuteOn extends ExecTask { protected Vector filesets = new Vector(); // contains AbstractFileSet // (both DirSet and FileSet) - private Union resources = new Union(); + private Union resources = null; private boolean relative = false; private boolean parallel = false; private boolean forwardSlash = false; @@ -112,6 +112,9 @@ public class ExecuteOn extends ExecTask { * @since Ant 1.7 */ public void add(ResourceCollection rc) { + if (resources == null) { + resources = new Union(); + } resources.add(rc); } @@ -294,7 +297,7 @@ public class ExecuteOn extends ExecTask { log("!! execon is deprecated. Use apply instead. !!"); } super.checkConfiguration(); - if (filesets.size() == 0 && resources.size() == 0) { + if (filesets.size() == 0 && resources == null) { throw new BuildException("no resources specified", getLocation()); } @@ -414,6 +417,7 @@ public class ExecuteOn extends ExecTask { } } + if (resources != null) { Iterator iter = resources.iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); @@ -482,6 +486,7 @@ public class ExecuteOn extends ExecTask { + (totalDirs != 1 ? "ies" : "y") + ".", verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); } + } } catch (IOException e) { throw new BuildException("Execute failed: " + e, e, getLocation()); } finally {