ppkarwasz commented on code in PR #779:
URL: https://github.com/apache/commons-io/pull/779#discussion_r2329756637
##########
src/main/java/org/apache/commons/io/input/BoundedInputStream.java:
##########
@@ -370,16 +370,10 @@ protected synchronized void afterRead(final int n) throws
IOException {
super.afterRead(n);
}
- /**
- * {@inheritDoc}
- */
@Override
public int available() throws IOException {
- if (isMaxCount()) {
- onMaxLength(maxCount, getCount());
- return 0;
- }
- return in.available();
+ final int remaining = Math.toIntExact(Math.min(getRemaining(),
Integer.MAX_VALUE));
Review Comment:
The value is between `0` (minimum value of `getRemaining()`) and
`Integer.MAX_VALUE`, so the call never throws.
In
https://github.com/apache/commons-io/pull/779/commits/ac15e4c30c1693df110ea754696ef702b01b59c8
I replaced it with a simple cast.
--
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]