Browse Source

use for loop instead of iterator when walking the list

of tasks, this allows tasks to be added to the current
list while the list is being walked.

Revert the script test that failed when it was adding
to the current task to test the change


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274822 13f79535-47bb-0310-9956-ffa450edef68
remotes/1776816827838153613/tmp_25f451bd36ab3145e487fcb2cd5c62c571e5b602
Peter Reilly 23 years ago
parent
commit
baf4809c2c
2 changed files with 3 additions and 4 deletions
  1. +1
    -1
      src/etc/testcases/taskdefs/optional/script.xml
  2. +2
    -3
      src/main/org/apache/tools/ant/Target.java

+ 1
- 1
src/etc/testcases/taskdefs/optional/script.xml View File

@@ -10,7 +10,7 @@

for (i=1; i<=10; i++) {
echo = testproject.createTask("echo");
example1.addTask(echo);
setup1.addTask(echo);
echo.setMessage(i*i);
}



+ 2
- 3
src/main/org/apache/tools/ant/Target.java View File

@@ -311,9 +311,8 @@ public class Target implements TaskContainer {
*/
public void execute() throws BuildException {
if (testIfCondition() && testUnlessCondition()) {
Iterator it = children.iterator();
while (it.hasNext()) {
Object o = it.next();
for (int i = 0; i < children.size(); ++i) {
Object o = children.get(i);
if (o instanceof Task) {
Task task = (Task) o;
task.perform();


Loading…
Cancel
Save