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(); } }
Supposed to be fixed in the 1.5 branch, please try with the latest build from <http://cvs.apache.org/~bodewig/gump/ant1.5beta/>.