peterreilly    2003/10/15 08:35:32

  Modified:    src/main/org/apache/tools/ant UnknownElement.java
                        IntrospectionHelper.java
               docs/manual/CoreTypes custom-programming.html
  Log:
  fix usage of mixed case names of add(typedef) introspection.
  fix by moving the tolower method from unknownelement to introspectionhelper.
  
  Revision  Changes    Path
  1.67      +2 -8      ant/src/main/org/apache/tools/ant/UnknownElement.java
  
  Index: UnknownElement.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/UnknownElement.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- UnknownElement.java       14 Oct 2003 08:51:27 -0000      1.66
  +++ UnknownElement.java       15 Oct 2003 15:35:31 -0000      1.67
  @@ -57,7 +57,6 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Locale;
   import java.io.IOException;
   
   /**
  @@ -515,13 +514,8 @@
       private boolean handleChild(IntrospectionHelper ih,
                                   Object parent, UnknownElement child,
                                   RuntimeConfigurable childWrapper) {
  -        // backwards compatibility - element names of nested
  -        // elements have been all lower-case in Ant, except for
  -        // TaskContainers
  -        // This does not work too good for typedefed elements...
  -        String childName =
  -            ProjectHelper.genComponentName(
  -                child.getNamespace(), child.getTag().toLowerCase(Locale.US));
  +        String childName = ProjectHelper.genComponentName(
  +            child.getNamespace(), child.getTag());
           if (ih.supportsNestedElement(childName)) {
               IntrospectionHelper.Creator creator =
                   ih.getElementCreator(getProject(), parent, childName);
  
  
  
  1.66      +5 -3      
ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
  
  Index: IntrospectionHelper.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- IntrospectionHelper.java  13 Sep 2003 12:58:33 -0000      1.65
  +++ IntrospectionHelper.java  15 Oct 2003 15:35:31 -0000      1.66
  @@ -594,7 +594,8 @@
       private NestedCreator getNestedCreator(Project project, Object parent,
           String elementName) throws BuildException {
   
  -        NestedCreator nc = (NestedCreator) nestedCreators.get(elementName);
  +        NestedCreator nc = (NestedCreator) nestedCreators.get(
  +            elementName.toLowerCase(Locale.US));
           if (nc == null) {
               nc = createAddTypeCreator(project, parent, elementName);
           }
  @@ -696,7 +697,7 @@
        * @return true if the given nested element is supported
        */
       public boolean supportsNestedElement(String elementName) {
  -        return nestedCreators.containsKey(elementName)
  +        return nestedCreators.containsKey(elementName.toLowerCase(Locale.US))
               || DynamicConfigurator.class.isAssignableFrom(bean)
               || addTypeMethods.size() != 0;
       }
  @@ -726,7 +727,8 @@
           if (elementName == null) {
               return;
           }
  -        NestedCreator ns = (NestedCreator) nestedCreators.get(elementName);
  +        NestedCreator ns = (NestedCreator) nestedCreators.get(
  +            elementName.toLowerCase(Locale.US));
           if (ns == null) {
               return;
           }
  
  
  
  1.7       +0 -2      ant/docs/manual/CoreTypes/custom-programming.html
  
  Index: custom-programming.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTypes/custom-programming.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- custom-programming.html   15 Oct 2003 13:20:29 -0000      1.6
  +++ custom-programming.html   15 Oct 2003 15:35:32 -0000      1.7
  @@ -39,8 +39,6 @@
       <p>
         After the class has been written, it is added to the ant system
         by using <code>&lt;typedef&gt;</code>.
  -      One thing to be aware of is that currently this will only work
  -      if the definition name is all lower case.
       </p>
       <h3><a name="customconditions">Custom Conditions</a></h3>
       <p>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to