Browse Source

fix usage of mixed case names of add(typedef) introspection.

fix by moving the tolower method from unknownelement to introspectionhelper.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275505 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
6dc2619ae5
3 changed files with 7 additions and 13 deletions
  1. +0
    -2
      docs/manual/CoreTypes/custom-programming.html
  2. +5
    -3
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  3. +2
    -8
      src/main/org/apache/tools/ant/UnknownElement.java

+ 0
- 2
docs/manual/CoreTypes/custom-programming.html View File

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


+ 5
- 3
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -594,7 +594,8 @@ public final class IntrospectionHelper implements BuildListener {
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 @@ public final class IntrospectionHelper implements BuildListener {
* @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 @@ public final class IntrospectionHelper implements BuildListener {
if (elementName == null) {
return;
}
NestedCreator ns = (NestedCreator) nestedCreators.get(elementName);
NestedCreator ns = (NestedCreator) nestedCreators.get(
elementName.toLowerCase(Locale.US));
if (ns == null) {
return;
}


+ 2
- 8
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -57,7 +57,6 @@ package org.apache.tools.ant;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.io.IOException;

/**
@@ -515,13 +514,8 @@ public class UnknownElement extends Task {
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);


Loading…
Cancel
Save