diff --git a/WHATSNEW b/WHATSNEW index 6e1e4dacd..8b787bafa 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -13,6 +13,11 @@ Fixed bugs: maps. Bugzilla Report 48310. + * The filesmatch condition threw a NullPointerException when + comparing text files and the second file contained fewer lines than + the first one. + Bugzilla Report 48715. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java index c2e03168e..d269ad4cb 100644 --- a/src/main/org/apache/tools/ant/util/ResourceUtils.java +++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java @@ -666,6 +666,9 @@ public class ResourceUtils { while (expected != null) { String actual = in2.readLine(); if (!expected.equals(actual)) { + if (actual == null) { + return 1; + } return expected.compareTo(actual); } expected = in1.readLine(); diff --git a/src/tests/antunit/taskdefs/condition/filesmatch-test.xml b/src/tests/antunit/taskdefs/condition/filesmatch-test.xml new file mode 100644 index 000000000..67e7c00f6 --- /dev/null +++ b/src/tests/antunit/taskdefs/condition/filesmatch-test.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +