DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9762>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9762 <linecontains> filter erroneously filters out adjacent matches Summary: <linecontains> filter erroneously filters out adjacent matches Product: Ant Version: 1.5Beta2 Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: Core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If there are two adjacent lines which should be matched by a <linecontains> filter, the second line is missed. This bug occurs in version 1.5Beta2 but not in version 1.5Beta1. You can duplicate this bug with the following files: ---------- begin build.xml ---------- <project name="bug" default="test"> <target name="test"> <loadproperties srcfile="test.props"> <filterchain> <linecontains> <contains value="foo."/> </linecontains> </filterchain> </loadproperties> <echo message="foo.bar = ${foo.bar}"/> <echo message="foo.baz = ${foo.baz}"/> </target> </project> ---------- end build.xml ---------- ---------- begin test.props ---------- foo.bar=1 foo.baz=2 baz.bletch=3 ---------- end test.props ---------- This example should load the properties foo.bar and foo.baz, but it does not load foo.baz. I looked at the source code for LineContains.java and found the following code in the read() method. This snippet is executed when looking for the next matching line. The comments are mine. line = readLine(); while((line != null) && (goodLine == null)) { // [code which sets goodLine to null if line doesn't match] line = readLine(); // if we matched a line, this readLine() will be lost! } if (goodLine != null) { line = goodLine; return read(); }; a quick fix is to change the while loop like this: while((line != null) && (goodLine == null)) { // [code which sets goodLine to null if line doesn't match] if (goodLine == null) { line = readLine(); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
