From a29e1aaf138cf3bc63dd4adf70604c95ff8ca64f Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 18 Dec 2001 20:19:07 +0000 Subject: [PATCH] * 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 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270251 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/IntrospectionHelper.java | 15 +++++++++++---- src/main/org/apache/tools/ant/ProjectHelper.java | 2 +- src/main/org/apache/tools/ant/UnknownElement.java | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index 92416445a..22dbba6eb 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -315,10 +315,17 @@ public class IntrospectionHelper implements BuildListener { */ public void addText(Project project, Object element, String text) { 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 { addText.invoke(element, new String[] {text}); diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index eef34445d..53d26274e 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -705,7 +705,7 @@ public class ProjectHelper { public static void addText(Project project, Object target, String text) throws BuildException { - if (text == null || text.trim().length() == 0) { + if (text == null ) { return; } diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java index af33d29f4..e1fd9e935 100644 --- a/src/main/org/apache/tools/ant/UnknownElement.java +++ b/src/main/org/apache/tools/ant/UnknownElement.java @@ -125,7 +125,7 @@ public class UnknownElement extends Task { } if (realThing instanceof Task) { - ((Task) realThing).perform(); + ((Task) realThing).execute(); } }