This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit dc1df1d4af4c2672f472663e18616297ed9adc46 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sun Apr 6 10:27:43 2025 -0400 Reuse Math --- .../org/apache/commons/io/input/RandomAccessFileInputStream.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java b/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java index 3e25bc625..a2dcd8925 100644 --- a/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java +++ b/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java @@ -166,11 +166,7 @@ public RandomAccessFileInputStream(final RandomAccessFile file, final boolean pr */ @Override public int available() throws IOException { - final long avail = availableLong(); - if (avail > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } - return (int) avail; + return Math.toIntExact(Math.min(availableLong(), Integer.MAX_VALUE)); } /**