Skip to content

Experiments#819

Draft
garydgregory wants to merge 319 commits into
fix/read-onlyfrom
master
Draft

Experiments#819
garydgregory wants to merge 319 commits into
fix/read-onlyfrom
master

Conversation

@garydgregory
Copy link
Copy Markdown
Member

No description provided.

garydgregory and others added 30 commits November 14, 2025 08:25
Bumps `commons.bytebuddy.version` from 1.17.8 to 1.18.1.

Updates `net.bytebuddy:byte-buddy` from 1.17.8 to 1.18.1
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](raphw/byte-buddy@byte-buddy-1.17.8...byte-buddy-1.18.1)

Updates `net.bytebuddy:byte-buddy-agent` from 1.17.8 to 1.18.1
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](raphw/byte-buddy@byte-buddy-1.17.8...byte-buddy-1.18.1)

---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
  dependency-version: 1.18.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: net.bytebuddy:byte-buddy-agent
  dependency-version: 1.18.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Inherit scm element
- Inherit ciManagement element
- Inherit issueManagement element
…an IllegalArgumentException for a new positive position that's too large (#817)

* [IO-856] Try test on all OSs for GitHub CI

* ByteArraySeekableByteChannel.position|truncate(long) shouldn't throw an
IllegalArgumentException for a new positive position that's too large

* Throw IOException instead of OutOfMemoryError

* Refactor internals for safer and less type casting
…an IllegalArgumentException for a new positive position that's too large #817
* [IO-856] Try test on all OSs for GitHub CI

* Add and use IOUtils.closeQuietly(Closeable, Throwable)

@Override
public long skip(final long n) throws IOException {
charsRead += n;

Check failure

Code scanning / CodeQL

Implicit narrowing conversion in compound assignment High

Implicit cast of source type long to narrower destination type
int
.

Copilot Autofix

AI 24 days ago

To fix this without changing intended behavior, avoid compound assignment between int and long. Compute the actual skipped amount from the underlying reader first, then update charsRead using a checked conversion from long to int.

Best fix in this file:

  • In skip(long n), replace:
    • charsRead += n;
    • return super.skip(n);
  • With:
    • final long skipped = super.skip(n);
    • charsRead = Math.addExact(charsRead, Math.toIntExact(skipped));
    • return skipped;

Why this is best:

  • Removes implicit narrowing conversion.
  • Tracks real skipped count (more accurate than adding requested n).
  • Fails fast with clear arithmetic exception on impossible overflow/truncation instead of silent corruption.
  • Requires no new imports (Math is in java.lang).
Suggested changeset 1
src/main/java/org/apache/commons/io/input/BoundedReader.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/main/java/org/apache/commons/io/input/BoundedReader.java b/src/main/java/org/apache/commons/io/input/BoundedReader.java
--- a/src/main/java/org/apache/commons/io/input/BoundedReader.java
+++ b/src/main/java/org/apache/commons/io/input/BoundedReader.java
@@ -132,7 +132,8 @@
 
     @Override
     public long skip(final long n) throws IOException {
-        charsRead += n;
-        return super.skip(n);
+        final long skipped = super.skip(n);
+        charsRead = Math.addExact(charsRead, Math.toIntExact(skipped));
+        return skipped;
     }
 }
EOF
@@ -132,7 +132,8 @@

@Override
public long skip(final long n) throws IOException {
charsRead += n;
return super.skip(n);
final long skipped = super.skip(n);
charsRead = Math.addExact(charsRead, Math.toIntExact(skipped));
return skipped;
}
}
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants