Browse Source

Add some sanity checks. If we allow an empty token, we end up in an

endless loop - as demonstrated by unittest test4.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268481 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
06f6d787d2
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/main/org/apache/tools/ant/taskdefs/Replace.java

+ 9
- 0
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -213,6 +213,15 @@ public class Replace extends MatchingTask {
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);
}
}

/**


Loading…
Cancel
Save