Browse Source

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
master
Costin Manolache 22 years ago
parent
commit
594d2dd6c8
1 changed files with 23 additions and 5 deletions
  1. +23
    -5
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java

+ 23
- 5
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -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 );


Loading…
Cancel
Save