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

        Matthew Madson created issue -
        Gary Gregory made changes -
        Field Original Value New Value
        Summary IOUtils.contentEquals(inputStream1, inputStream2) returns false if inputStream1 == inputStream2, should return true IOUtils.contentEquals* methods returns false if input1 == input2, should return true
        Gary Gregory made changes -
        Description The fix should be relatively simple, just add an identity check to the beginning of the method:

        if(is1 == is2) {
          return true;
        }
        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)
        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.
        Gary Gregory made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.5 [ 12322486 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        3d 14h 52m 1 Gary Gregory 04/Jan/13 15:57

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development