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:47:41 GMT
bodewig     2002/07/22 05:47:41

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        RuntimeConfigurable.java Task.java
  Log:
  recreate children when replacing task instances.
  
  PR: 10904
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.67 +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.66
  retrieving revision 1.263.2.67
  diff -u -r1.263.2.66 -r1.263.2.67
  --- WHATSNEW	17 Jul 2002 07:38:04 -0000	1.263.2.66
  +++ WHATSNEW	22 Jul 2002 12:47:41 -0000	1.263.2.67
  @@ -17,6 +17,8 @@
   * ant -diagnostics was not working properly when the task dependency
     was missing and was just printing the missing dependency.
   
  +* If a task got redefined via <taskdef>, it lost its child elements.
  +
   Other changes:
   --------------
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.3  +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.14.2.2
  retrieving revision 1.14.2.3
  diff -u -r1.14.2.2 -r1.14.2.3
  --- RuntimeConfigurable.java	12 Jun 2002 08:48:21 -0000	1.14.2.2
  +++ RuntimeConfigurable.java	22 Jul 2002 12:47:41 -0000	1.14.2.3
  @@ -149,6 +149,15 @@
       }
   
       /**
  +     * Returns an enumeration of all child wrappers.
  +     *
  +     * @since Ant 1.5.1
  +     */
  +    Enumeration getChildren() {
  +        return children.elements();
  +    }
  +
  +    /**
        * Adds characters from #PCDATA areas to the wrapped element.
        *
        * @param data Text to add to the wrapped element.
  
  
  
  1.27.2.3  +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.27.2.2
  retrieving revision 1.27.2.3
  diff -u -r1.27.2.2 -r1.27.2.3
  --- Task.java	12 Jun 2002 08:48:21 -0000	1.27.2.2
  +++ Task.java	22 Jul 2002 12:47:41 -0000	1.27.2.3
  @@ -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 instance for each child
  +     * element of replacement.
  +     *
  +     * @since Ant 1.5.1
  +     */
  +    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