ppkarwasz commented on code in PR #776:
URL: https://github.com/apache/commons-io/pull/776#discussion_r2325125429


##########
src/main/java/org/apache/commons/io/IOUtils.java:
##########
@@ -2707,9 +2790,6 @@ public static byte[] toByteArray(final InputStream input, 
final long size) throw
      * @throws IllegalArgumentException if {@code size} is less than zero.
      */
     static byte[] toByteArray(final IOTriFunction<byte[], Integer, Integer, 
Integer> input, final int size) throws IOException {
-        if (size < 0) {

Review Comment:
   This method is package-private, so it’s reasonable to push the 
responsibility for validating array size onto the callers. At one point most 
callers already performed this check, so I added it to the one missing call 
site and removed it here.
   
   After reviewing it again, I agree the check belongs here, so I’ll restore it 
and remove the duplicates in the callers. Fixed in 
https://github.com/apache/commons-io/pull/776/commits/d748e99d390eef117d54bf175dcaa569e2b9106d



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to