bodewig 01/01/19 06:55:57
Modified: src/main/org/apache/tools/ant/taskdefs Replace.java
Log:
Add some sanity checks. If we allow an empty token, we end up in an
endless loop - as demonstrated by unittest test4.
Revision Changes Path
1.10 +9 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
Index: Replace.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Replace.java 2001/01/15 01:26:11 1.9
+++ Replace.java 2001/01/19 14:55:54 1.10
@@ -213,6 +213,15 @@
String message = "Property file " + propertyFile.getPath() + "
does not exist.";
throw new BuildException(message, location);
}
+ if (token == null && replacefilters.size() == 0) {
+ String message = "Either token or a nested replacefilter "
+ + "must be specified";
+ throw new BuildException(message, location);
+ }
+ if (token != null && "".equals(token.getText())) {
+ String message ="The token attribute must not be an empty
string.";
+ throw new BuildException(message, location);
+ }
}
/**