Browse Source

Make the handling of nested #PCDATA more predictable by not stripping

anything. The older version depended upon the parser (does it invoke
characters once per #PCDATA section or once per line).


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268024 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
ad48a0d392
4 changed files with 27 additions and 6 deletions
  1. +15
    -0
      build.xml
  2. +7
    -3
      src/main/org/apache/tools/ant/ProjectHelper.java
  3. +1
    -1
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  4. +4
    -2
      src/testcases/org/apache/tools/ant/taskdefs/EchoTest.java

+ 15
- 0
build.xml View File

@@ -326,5 +326,20 @@
<deltree dir="src/etc/testcases/taskdefs.tmp" />
</target>

<target name="run.single.test" if="testcase" depends="compiletests">
<junit printsummary="no" fork="yes" haltonfailure="yes">
<classpath>
<pathelement location="${lib.dir}/${name}.jar" />
<pathelement location="${build.tests}" />
<path refid="classpath" />
<pathelement path="${java.class.path}" />
</classpath>

<formatter type="plain" usefile="false" />

<test name="${testcase}" />
</junit>
</target>

</project>


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

@@ -423,7 +423,11 @@ public class ProjectHelper {
RuntimeConfigurable parentWrapper) {
super(parentHandler);

this.target = target;
if (target instanceof TaskAdapter) {
this.target = ((TaskAdapter) target).getProxy();
} else {
this.target = target;
}
this.parentWrapper = parentWrapper;
}

@@ -538,7 +542,7 @@ public class ProjectHelper {
*/
public static void addText(Object target, char[] buf, int start, int end)
throws BuildException {
addText(target, new String(buf, start, end).trim());
addText(target, new String(buf, start, end));
}

/**
@@ -547,7 +551,7 @@ public class ProjectHelper {
public static void addText(Object target, String text)
throws BuildException {

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



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

@@ -123,7 +123,7 @@ public class RuntimeConfigurable {
* Add characters from #PCDATA areas to the wrapped element.
*/
public void addText(char[] buf, int start, int end) {
addText(new String(buf, start, end).trim());
addText(new String(buf, start, end));
}

/**


+ 4
- 2
src/testcases/org/apache/tools/ant/taskdefs/EchoTest.java View File

@@ -78,10 +78,12 @@ public class EchoTest extends TaskdefsTest {
}
public void test3() {
expectOutput("test3", "This \n"+
expectOutput("test3", "\n"+
" This \n"+
" is\n"+
" a \n"+
" multiline\n"+
" message\n");
" message\n"+
" \n");
}
}

Loading…
Cancel
Save