peterreilly 2004/01/07 02:25:54 Modified: src/main/org/apache/tools/ant/types Tag: ANT_16_BRANCH FilterSet.java src/testcases/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH CopyTest.java src/etc/testcases/taskdefs Tag: ANT_16_BRANCH copy.xml Log: Sync with head Revision Changes Path No revision No revision 1.23.2.2 +17 -3 ant/src/main/org/apache/tools/ant/types/FilterSet.java Index: FilterSet.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/FilterSet.java,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -u -r1.23.2.1 -r1.23.2.2 --- FilterSet.java 7 Jan 2004 10:11:38 -0000 1.23.2.1 +++ FilterSet.java 7 Jan 2004 10:25:53 -0000 1.23.2.2 @@ -351,14 +351,28 @@ /** * 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 @@ return parent; } passedTokens.addElement(parent); - String value = this.replaceTokens(line); + String value = iReplaceTokens(line); if (value.indexOf(getBeginToken()) == -1 && !duplicateToken) { duplicateToken = false; passedTokens = null; No revision No revision 1.12.2.2 +5 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java Index: CopyTest.java =================================================================== RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -r1.12.2.1 -r1.12.2.2 --- CopyTest.java 7 Jan 2004 10:11:38 -0000 1.12.2.1 +++ CopyTest.java 7 Jan 2004 10:25:53 -0000 1.12.2.2 @@ -130,6 +130,11 @@ 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"); No revision No revision 1.11.2.2 +14 -0 ant/src/etc/testcases/taskdefs/copy.xml Index: copy.xml =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/copy.xml,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -r1.11.2.1 -r1.11.2.2 --- copy.xml 7 Jan 2004 10:11:38 -0000 1.11.2.1 +++ copy.xml 7 Jan 2004 10:25:54 -0000 1.11.2.2 @@ -28,6 +28,20 @@ <concat><path path="copy.filter.out"/></concat> </target> + <target name="infinitetest"> + <delete quiet="yes" file="copy.filter.out"/> + <delete quiet="yes" file="copy.filter.inp"/> + <concat destfile="copy.filter.inp"> +a=b= + </concat> + <copy file="copy.filter.inp" tofile="copy.filter.out"> + <filterset begintoken="=" endtoken="="> + <filter token="b" value="=b="/> + </filterset> + </copy> + <concat><path path="copy.filter.out"/></concat> + </target> + <target name="test3"> <!-- create an empty file --> <touch file="copytest3.tmp"/>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]