Browse Source

* addConfigured methods for custom tasks were being called twice. This

problem was caused by RuntimeConfigurable.maybeConfigure() being called
twice on the task's RuntimeConfigurable - once in
UnknownElement.maybeConfigure(), and once in the custom task's perform()
method.

* Whitespace in text content was sometimes being thrown away, depending on
how the SAX parser decided to divide it across calls to
ContentHandler.characters().

Submitted by:	Adam Murdoch <adammurdoch_ml@yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270251 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
a29e1aaf13
3 changed files with 13 additions and 6 deletions
  1. +11
    -4
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  2. +1
    -1
      src/main/org/apache/tools/ant/ProjectHelper.java
  3. +1
    -1
      src/main/org/apache/tools/ant/UnknownElement.java

+ 11
- 4
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -315,10 +315,17 @@ public class IntrospectionHelper implements BuildListener {
*/ */
public void addText(Project project, Object element, String text) { public void addText(Project project, Object element, String text) {
if (addText == null) { if (addText == null) {
String msg = getElementName(project, element) +
//String msg = "Class " + element.getClass().getName() +
" doesn't support nested text data.";
throw new BuildException(msg);
// Element doesn't handle text content
if ( text.trim().length() == 0 ) {
// Only whitespace - ignore
return;
}
else {
// Not whitespace - fail
String msg = getElementName(project, element) +
" doesn't support nested text data.";
throw new BuildException(msg);
}
} }
try { try {
addText.invoke(element, new String[] {text}); addText.invoke(element, new String[] {text});


+ 1
- 1
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -705,7 +705,7 @@ public class ProjectHelper {
public static void addText(Project project, Object target, String text) public static void addText(Project project, Object target, String text)
throws BuildException { throws BuildException {


if (text == null || text.trim().length() == 0) {
if (text == null ) {
return; return;
} }




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

@@ -125,7 +125,7 @@ public class UnknownElement extends Task {
} }


if (realThing instanceof Task) { if (realThing instanceof Task) {
((Task) realThing).perform();
((Task) realThing).execute();
} }
} }




Loading…
Cancel
Save