brettlounsbury commented on a change in pull request #101: IO-649 - Improve the 
performance of the contentEquals() methods.
URL: https://github.com/apache/commons-io/pull/101#discussion_r365991723
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/IOUtils.java
 ##########
 @@ -708,31 +706,79 @@ public static void closeQuietly(final Writer output) {
     @SuppressWarnings("resource")
     public static boolean contentEquals(final InputStream input1, final 
InputStream input2)
             throws IOException {
+        return contentEquals(input1, input2, DEFAULT_BUFFER_SIZE);
+    }
+
+    /**
+     * Compares the contents of two Streams to determine if they are equal or 
not.
+     * <p>
+     * This method buffers the input internally.
+     *
+     * @param input1 the first stream
+     * @param input2 the second stream
+     * @param bufferSize the size of the internal buffer to use.
+     * @return true if the content of the streams are equal or they both don't
+     * exist, false otherwise
+     * @throws NullPointerException if either input is null
 
 Review comment:
   This documentation is a clone/mutate from the original method's javadoc (the 
one without the bufferSize).  This doesn't look to be explicitly thrown, but if 
either InputStream is null it throws due to the stream being dereferenced.
   
   Check the javadoc for the `public static boolean contentEquals(final 
InputStream input1, final InputStream input2)` method.
   
   Happy to either (a) explicitly throw a NullPointerException up front, (b) 
remove the comment from both places, or (c) do nothing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to