ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1151473 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/AugmentReference.java
Date Wed, 27 Jul 2011 14:08:02 GMT
Author: bodewig
Date: Wed Jul 27 14:08:00 2011
New Revision: 1151473

URL: http://svn.apache.org/viewvc?rev=1151473&view=rev
Log:
restore RCW id once augment has performed its job so it can be reused by other targets.  PR
50894

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1151473&r1=1151472&r2=1151473&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Jul 27 14:08:00 2011
@@ -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:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java?rev=1151473&r1=1151472&r2=1151473&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java Wed Jul 27
14:08:00 2011
@@ -70,4 +70,26 @@ public class AugmentReference extends Ta
             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());
+        }
+    }
+
 }



Mime
View raw message