Browse Source

<echoproperties> setPrefix javadoc claimed null or empty prefix would be

ignored; instead an error was thrown.  Bugzilla report 39954.
Submitted by Ivan Ivanov.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@419276 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 19 years ago
parent
commit
b49a9ef6f2
4 changed files with 20 additions and 7 deletions
  1. +4
    -1
      WHATSNEW
  2. +4
    -0
      src/etc/testcases/taskdefs/optional/echoproperties.xml
  3. +7
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
  4. +5
    -1
      src/testcases/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java

+ 4
- 1
WHATSNEW View File

@@ -238,9 +238,12 @@ Fixed bugs:
* If the class invoked by the <java> task threw a ClassNotFoundException, * If the class invoked by the <java> task threw a ClassNotFoundException,
this was misinterpreted as the specified class itself not being found. this was misinterpreted as the specified class itself not being found.


* <echoproperties> setPrefix javadoc claimed null or empty prefix would be
ignored; instead an error was thrown. Bugzilla report 39954.

Other changes: Other changes:
-------------- --------------
* took in bugzilla report 39320.
* Took in bugzilla report 39320.


* Improve compatibility with GNU Classpath and java versions prior to 1.5. Bugzilla 39027. * Improve compatibility with GNU Classpath and java versions prior to 1.5. Bugzilla 39027.




+ 4
- 0
src/etc/testcases/taskdefs/optional/echoproperties.xml View File

@@ -12,6 +12,10 @@
<echoproperties /> <echoproperties />
</target> </target>


<target name="testEchoWithEmptyPrefixToLog" depends="setup">
<echoproperties prefix=""/>
</target>

<target name="testEchoToLogXml" depends="setup"> <target name="testEchoToLogXml" depends="setup">
<echoproperties format="xml" /> <echoproperties format="xml" />
</target> </target>


+ 7
- 5
src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2005 The Apache Software Foundation
* Copyright 2002-2006 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -174,10 +174,12 @@ public class EchoProperties extends Task {
*@param prefix The new prefix value *@param prefix The new prefix value
*/ */
public void setPrefix(String prefix) { public void setPrefix(String prefix) {
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendPrefix(prefix);
addPropertyset(ps);
if (prefix != null && prefix.length() != 0) {
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendPrefix(prefix);
addPropertyset(ps);
}
} }


/** /**


+ 5
- 1
src/testcases/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2005 The Apache Software Foundation
* Copyright 2000-2006 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -63,6 +63,10 @@ public class EchoPropertiesTest extends BuildFileTest {
expectLogContaining("testEchoToLog", "test.property="+TEST_VALUE); expectLogContaining("testEchoToLog", "test.property="+TEST_VALUE);
} }


public void testEchoWithEmptyPrefixToLog() {
expectLogContaining("testEchoWithEmptyPrefixToLog", "test.property="+TEST_VALUE);
}



public void testReadBadFile() { public void testReadBadFile() {
expectBuildExceptionContaining( "testReadBadFile", expectBuildExceptionContaining( "testReadBadFile",


Loading…
Cancel
Save