ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant RuntimeConfigurable.java Task.java
Date Mon, 22 Jul 2002 12:28:57 GMT
bodewig     2002/07/22 05:28:57

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant RuntimeConfigurable.java
                        Task.java
  Log:
  Make task replacements recreate their child elements when they get redefined.
  
  PR: 10904
  
  This should also fix the Axis build failure Sam has reported.
  
  Revision  Changes    Path
  1.279     +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.278
  retrieving revision 1.279
  diff -u -r1.278 -r1.279
  --- WHATSNEW	19 Jul 2002 17:48:36 -0000	1.278
  +++ WHATSNEW	22 Jul 2002 12:28:57 -0000	1.279
  @@ -21,6 +21,8 @@
   * The ExpandProperties filter threw NPEs when defined using
     the <filterreader> format.
   
  +* If a task got redefined via <taskdef>, it lost its child elements.
  +
   Other changes:
   --------------
   
  
  
  
  1.16      +9 -0      jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
  
  Index: RuntimeConfigurable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RuntimeConfigurable.java	22 Jun 2002 23:38:30 -0000	1.15
  +++ RuntimeConfigurable.java	22 Jul 2002 12:28:57 -0000	1.16
  @@ -149,6 +149,15 @@
       }
   
       /**
  +     * Returns an enumeration of all child wrappers.
  +     *
  +     * @since Ant 1.6
  +     */
  +    Enumeration getChildren() {
  +        return children.elements();
  +    }
  +
  +    /**
        * Adds characters from #PCDATA areas to the wrapped element.
        *
        * @param data Text to add to the wrapped element.
  
  
  
  1.30      +24 -0     jakarta-ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Task.java	22 Jun 2002 23:38:30 -0000	1.29
  +++ Task.java	22 Jul 2002 12:28:57 -0000	1.30
  @@ -54,6 +54,8 @@
   
   package org.apache.tools.ant;
   
  +import java.util.Enumeration;
  +
   /**
    * Base class for all tasks.
    *
  @@ -372,9 +374,31 @@
               replacement.setOwningTarget(target);
               replacement.setRuntimeConfigurableWrapper(wrapper);
               wrapper.setProxy(replacement);
  +            replaceChildren(wrapper, replacement);
               target.replaceChild(this, replacement);
               replacement.maybeConfigure();
           }
           return replacement;
  +    }
  +
  +    /**
  +     * Recursively adds an UnknownElement instances for each child
  +     * element of replacement.
  +     *
  +     * @since Ant 1.6
  +     */
  +    private void replaceChildren(RuntimeConfigurable wrapper,
  +                                 UnknownElement parentElement) {
  +        Enumeration enum = wrapper.getChildren();
  +        while (enum.hasMoreElements()) {
  +            RuntimeConfigurable childWrapper =
  +                (RuntimeConfigurable) enum.nextElement();
  +            UnknownElement childElement = 
  +                new UnknownElement(childWrapper.getElementTag());
  +            parentElement.addChild(childElement);
  +            childElement.setRuntimeConfigurableWrapper(childWrapper);
  +            childWrapper.setProxy(childElement);
  +            replaceChildren(childWrapper, childElement);
  +        }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message