NPE in
org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader)
when only one input is null.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -167,10 +167,13 @@ The <action> type attribute can be add,update,fix,remove.
</action>
<action issue="IO-640" dev="ggregory" type="add" due-to="Gary Gregory">
NPE in org.apache.commons.io.IOUtils.contentEquals(InputStream, InputStream) when only one input is null.
- </action>
+ </action>"src/changes/changes.xml"
<action issue="IO-641" dev="ggregory" type="add" due-to="Gary Gregory">
NPE in org.apache.commons.io.IOUtils.contentEquals(Reader, Reader) when only one input is null.
</action>
+ <action issue="IO-642" dev="ggregory" type="add" due-to="Gary Gregory">
+ NPE in org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader) when only one input is null.
+ </action>
</release>
<release version="2.6" date="2017-10-15" description="Java 7 required, Java 9 supported.">

MODIFY
src/main/java/org/apache/commons/io/IOUtils.java
src/main/java/org/apache/commons/io/IOUtils.java
@@ -789,6 +789,9 @@ public static boolean contentEqualsIgnoreEOL(final Reader input1, final Reader i
if (input1 == input2) {
return true;
}
+ if (input1 == null ^ input2 == null) {
+ return false;
+ }
final BufferedReader br1 = toBufferedReader(input1);
final BufferedReader br2 = toBufferedReader(input2);

MODIFY
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
@@ -290,6 +290,18 @@ public synchronized void close() throws IOException {
}
@Test public void testContentEqualsIgnoreEOL() throws Exception {
+ {
+ final Reader input1 = new CharArrayReader("".toCharArray());
+ assertTrue(IOUtils.contentEqualsIgnoreEOL((Reader) null, null));
+ }
+ {
+ final Reader input1 = new CharArrayReader("".toCharArray());
+ assertFalse(IOUtils.contentEqualsIgnoreEOL(null, input1));
+ }
+ {
+ final Reader input1 = new CharArrayReader("".toCharArray());
+ assertFalse(IOUtils.contentEqualsIgnoreEOL(input1, null));
+ }
{
final Reader input1 = new CharArrayReader("".toCharArray());
assertTrue(IOUtils.contentEqualsIgnoreEOL(input1, input1));

[IO-642] NPE in
org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader)
when only one input is null.