Browse Source

restore RCW id once augment has performed its job so it can be reused by other targets. PR 50894

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1151473 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 14 years ago
parent
commit
045ec77262
2 changed files with 26 additions and 0 deletions
  1. +4
    -0
      WHATSNEW
  2. +22
    -0
      src/main/org/apache/tools/ant/taskdefs/AugmentReference.java

+ 4
- 0
WHATSNEW View File

@@ -73,6 +73,10 @@ Fixed bugs:
* <sync> didn't work properly when working on resource collections.
Bugzilla Report 51462.

* <augment> cause a NullPointerException if it was used in a target
that was invoked by multiple targets from the command line.
Bugzilla Report 50894.

Other changes:
--------------



+ 22
- 0
src/main/org/apache/tools/ant/taskdefs/AugmentReference.java View File

@@ -70,4 +70,26 @@ public class AugmentReference extends Task implements TypeAdapter {
wrapper.setElementTag("augmented reference \"" + id + "\"");
}
}

/**
* Overridden to restore the wrapper once it is no longer needed.
* @since Ant 1.8.3
*/
public void execute() {
restoreWrapperId();
}

/**
* Needed if two different targets reuse the same instance.
* @see https://issues.apache.org/bugzilla/show_bug.cgi?id=50894
*/
private synchronized void restoreWrapperId() {
if (id != null) {
log("restoring augment wrapper " + id, Project.MSG_DEBUG);
RuntimeConfigurable wrapper = getWrapper();
wrapper.setAttribute("id", id);
wrapper.setElementTag(getTaskName());
}
}

}

Loading…
Cancel
Save