Re: svn commit: r1151473 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/AugmentReference.java

2011-07-27 Thread Matt Benson
Removing my figurative hat!  The bit of time I had spent looking at
this didn't bear fruit; can't believe it was this simple.  Thanks
Stefan!

Matt

On Wed, Jul 27, 2011 at 9:08 AM,  bode...@apache.org wrote:
 Author: bodewig
 Date: Wed Jul 27 14:08:00 2011
 New Revision: 1151473

 URL: http://svn.apache.org/viewvc?rev=1151473view=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=1151473r1=1151472r2=1151473view=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=1151473r1=1151472r2=1151473view=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());
 +        }
 +    }
 +
  }




-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: svn commit: r1151473 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/AugmentReference.java

2011-07-27 Thread Stefan Bodewig
On 2011-07-27, Matt Benson wrote:

 The bit of time I had spent looking at this didn't bear fruit; can't
 believe it was this simple.

It took quite a few System.err.printlns to get there 8-)

Stefan

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org