From 594d2dd6c891e638a4a9ce006a8167594b0cabf6 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Tue, 17 Dec 2002 05:47:16 +0000 Subject: [PATCH] Fix for the lowercase problem. Sorry for the delay, I didn't have access to email this weekend. The code may still have a small problem - but the original had similar issues. I'll try to move the fix in UE later this week. I think getting to a consistent behavior is quite important - I wouldn't mind having all elements converted to lowercase, and I don't remember and design and explicit decision to have some lowercased and some not. If you still see problems - switch back to the original PH. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273671 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/helper/ProjectHelper2.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index 2562addf6..122f34b27 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -64,6 +64,7 @@ import java.io.UnsupportedEncodingException; import java.util.Hashtable; import java.util.Vector; import java.util.Stack; +import java.util.Locale; import org.xml.sax.Locator; import org.xml.sax.InputSource; @@ -806,7 +807,29 @@ public class ProjectHelper2 extends ProjectHelper { { RuntimeConfigurable parentWrapper=context.currentWrapper(); RuntimeConfigurable wrapper=null; + Object parent=null; + if( parentWrapper!=null ) { + parent=parentWrapper.getProxy(); + } + + if( parent != null ) { + // nested elements. Backward compatibilitiy - only nested elements + // are lower cased in the original processor + qname=qname.toLowerCase( Locale.US ); + // XXX What about nested elements that are inside TaskContainers ? + // We can't know that that we need lowercase until we know + // parent is not a TaskContainer. Maybe this test should + // be done in UnknownElement. + + // Note: the original code seems to have a similar problem: the lowercase + // conversion happens only inside ProjectHelper, if we know that the + // parent is not TaskContainer. If the parent is not known - UE are used + // and AFAIK there is no code to deal with that, so the conversion will be + // different based on context ( if the enclosing task is taskdefed in target + // or known at top level ). + } + /* UnknownElement is used for tasks and data types - with delayed eval */ UnknownElement task= new UnknownElement(qname); @@ -823,11 +846,6 @@ public class ProjectHelper2 extends ProjectHelper { context.configureId(task, attrs); - Object parent=null; - if( parentWrapper!=null ) { - parent=parentWrapper.getProxy(); - } - if( parent != null ) { // Nested element ((UnknownElement)parent).addChild( task );