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=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());
> +        }
> +    }
> +
>  }
>
>
>

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

Reply via email to