git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268482 13f79535-47bb-0310-9956-ffa450edef68master
@@ -23,4 +23,22 @@ | |||||
token="dont_want_to_really_replace_something"/> | token="dont_want_to_really_replace_something"/> | ||||
</target> | </target> | ||||
<target name="test6"> | |||||
<replace file="template.xml"> | |||||
<replacefilter /> | |||||
</replace> | |||||
</target> | |||||
<target name="test7"> | |||||
<replace file="template.xml"> | |||||
<replacefilter token="" /> | |||||
</replace> | |||||
</target> | |||||
<target name="test8"> | |||||
<replace file="template.xml"> | |||||
<replacefilter token="dont_want_to_really_replace_something" /> | |||||
</replace> | |||||
</target> | |||||
</project> | </project> |
@@ -107,6 +107,11 @@ public class Replace extends MatchingTask { | |||||
throw new BuildException(message); | throw new BuildException(message); | ||||
} | } | ||||
if ("".equals(token)) { | |||||
String message ="The token attribute must not be an empty string."; | |||||
throw new BuildException(message); | |||||
} | |||||
//value and property are mutually exclusive attributes | //value and property are mutually exclusive attributes | ||||
if ((value != null) && (property != null)) { | if ((value != null) && (property != null)) { | ||||
String message = "Either value or property " + "can be specified, but a replacefilter " + "element cannot have both."; | String message = "Either value or property " + "can be specified, but a replacefilter " + "element cannot have both."; | ||||
@@ -87,4 +87,12 @@ public class ReplaceTest extends TaskdefsTest { | |||||
executeTarget("test5"); | executeTarget("test5"); | ||||
} | } | ||||
public void test6() { | |||||
expectBuildException("test6", "required argument not specified"); | |||||
} | |||||
public void test7() { | |||||
expectBuildException("test7", "empty token not allowed"); | |||||
} | |||||
} | } |