diff --git a/src/etc/testcases/taskdefs/copy.xml b/src/etc/testcases/taskdefs/copy.xml index 57e9d695d..f797fe422 100644 --- a/src/etc/testcases/taskdefs/copy.xml +++ b/src/etc/testcases/taskdefs/copy.xml @@ -28,6 +28,20 @@ PRODUCT_BUILD=6.5 (BLD_65036) + + + + +a=b= + + + + + + + + + diff --git a/src/main/org/apache/tools/ant/types/FilterSet.java b/src/main/org/apache/tools/ant/types/FilterSet.java index 4e3e60170..be8c6ea8d 100644 --- a/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/src/main/org/apache/tools/ant/types/FilterSet.java @@ -351,14 +351,28 @@ public class FilterSet extends DataType implements Cloneable { /** * Does replacement on the given string with token matching. - * This uses the defined begintoken and endtoken values which default to @ for both. + * This uses the defined begintoken and endtoken values which default + * to @ for both. + * This resets the passedTokens and calls iReplaceTokens to + * do the actual replacements. * * @param line The line to process the tokens in. * @return The string with the tokens replaced. */ public String replaceTokens(String line) { passedTokens = null; // reset for new line - + return iReplaceTokens(line); + } + + /** + * Does replacement on the given string with token matching. + * This uses the defined begintoken and endtoken values which default + * to @ for both. + * + * @param line The line to process the tokens in. + * @return The string with the tokens replaced. + */ + private String iReplaceTokens(String line) { String beginToken = getBeginToken(); String endToken = getEndToken(); int index = line.indexOf(beginToken); @@ -439,7 +453,7 @@ public class FilterSet extends DataType implements Cloneable { return parent; } passedTokens.addElement(parent); - String value = this.replaceTokens(line); + String value = iReplaceTokens(line); if (value.indexOf(getBeginToken()) == -1 && !duplicateToken) { duplicateToken = false; passedTokens = null; diff --git a/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java b/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java index 74e9edc9c..779055a29 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java @@ -130,6 +130,11 @@ public class CopyTest extends BuildFileTest { executeTarget("filtertest"); assertTrue(getOutput().indexOf("loop in tokens") == -1); } + + public void testInfiniteFilter() { + executeTarget("infinitetest"); + assertTrue(getOutput().indexOf("loop in tokens") != -1); + } public void testFilterSet() throws IOException { executeTarget("testFilterSet");