Commons IO
  1. Commons IO
  2. IO-362

IOUtils.contentEquals* methods returns false if input1 == input2, should return true

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: Utilities
    • Labels:
      None

      Description

      The fix should be relatively simple, just add an identity check to the beginning of the method:

      if(is1 == is2)

      { return true; }

      The methods affected are:

      • org.apache.commons.io.IOUtils.contentEquals(InputStream, InputStream)
      • org.apache.commons.io.IOUtils.contentEquals(Reader, Reader)
      • org.apache.commons.io.IOUtils.contentEqualsIgnoreEOL(Reader, Reader)

        Activity

        Hide
        Gary Gregory added a comment -

        Fix implemented for the method in the original report and two other IOUtil methods.

        commit -m "[IO-362] IOUtils.contentEquals* methods returns false if input1 == input2, should return true." C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/IOUtilsTestCase.java C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/IOUtils.java
            Sending        C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml
            Sending        C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/IOUtils.java
            Sending        C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
            Transmitting file data ...
            Committed revision 1428941.
        
        Show
        Gary Gregory added a comment - Fix implemented for the method in the original report and two other IOUtil methods. commit -m "[IO-362] IOUtils.contentEquals* methods returns false if input1 == input2, should return true." C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/IOUtilsTestCase.java C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/IOUtils.java Sending C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml Sending C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/IOUtils.java Sending C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/IOUtilsTestCase.java Transmitting file data ... Committed revision 1428941.

          People

          • Assignee:
            Unassigned
            Reporter:
            Matthew Madson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development