Browse Source

empty collection != no collection

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@306520 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
c6a2ce5a05
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

+ 7
- 2
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -57,7 +57,7 @@ public class ExecuteOn extends ExecTask {


protected Vector filesets = new Vector(); // contains AbstractFileSet protected Vector filesets = new Vector(); // contains AbstractFileSet
// (both DirSet and FileSet) // (both DirSet and FileSet)
private Union resources = new Union();
private Union resources = null;
private boolean relative = false; private boolean relative = false;
private boolean parallel = false; private boolean parallel = false;
private boolean forwardSlash = false; private boolean forwardSlash = false;
@@ -112,6 +112,9 @@ public class ExecuteOn extends ExecTask {
* @since Ant 1.7 * @since Ant 1.7
*/ */
public void add(ResourceCollection rc) { public void add(ResourceCollection rc) {
if (resources == null) {
resources = new Union();
}
resources.add(rc); resources.add(rc);
} }


@@ -294,7 +297,7 @@ public class ExecuteOn extends ExecTask {
log("!! execon is deprecated. Use apply instead. !!"); log("!! execon is deprecated. Use apply instead. !!");
} }
super.checkConfiguration(); super.checkConfiguration();
if (filesets.size() == 0 && resources.size() == 0) {
if (filesets.size() == 0 && resources == null) {
throw new BuildException("no resources specified", throw new BuildException("no resources specified",
getLocation()); getLocation());
} }
@@ -414,6 +417,7 @@ public class ExecuteOn extends ExecTask {
} }
} }
if (resources != null) {
Iterator iter = resources.iterator(); Iterator iter = resources.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Resource res = (Resource) iter.next(); Resource res = (Resource) iter.next();
@@ -482,6 +486,7 @@ public class ExecuteOn extends ExecTask {
+ (totalDirs != 1 ? "ies" : "y") + ".", + (totalDirs != 1 ? "ies" : "y") + ".",
verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); verbose ? Project.MSG_INFO : Project.MSG_VERBOSE);
} }
}
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("Execute failed: " + e, e, getLocation()); throw new BuildException("Execute failed: " + e, e, getLocation());
} finally { } finally {


Loading…
Cancel
Save