Experiments#819
Draft
garydgregory wants to merge 313 commits intofix/read-onlyfrom
Draft
Conversation
Bumps [commons-codec:commons-codec](https://github.com/apache/commons-codec) from 1.19.0 to 1.20.0. - [Changelog](https://github.com/apache/commons-codec/blob/master/RELEASE-NOTES.txt) - [Commits](apache/commons-codec@rel/commons-codec-1.19.0...rel/commons-codec-1.20.0) --- updated-dependencies: - dependency-name: commons-codec:commons-codec dependency-version: 1.20.0 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>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.2 to 4.31.3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@0499de3...014f16e) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.8.1 to 4.8.2. - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](actions/dependency-review-action@40c09b7...3c4e3dc) --- updated-dependencies: - dependency-name: actions/dependency-review-action dependency-version: 4.8.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 91 to 92. - [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt) - [Commits](https://github.com/apache/commons-parent/commits) --- updated-dependencies: - dependency-name: org.apache.commons:commons-parent dependency-version: '92' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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
* [IO-856] Try test on all OSs for GitHub CI * Add channel filters * Rename test class * Javadoc * Add FilterFileChannel
* [IO-856] Try test on all OSs for GitHub CI * [IO-889] Tailer.close() does not guarantee file close - Add test class - Green on macOS locally * [IO-889] Tailer.close() does not guarantee file close - Add test class - Green on macOS locally - Fails on Windows on GH CI
* [IO-856] Try test on all OSs for GitHub CI * Javadoc - Make some package-private constructors private - Provide "default" constructors for simple use cases
UnsynchronizedBufferedReader.UnsynchronizedBufferedReader(Reader, int)
for input less than or equal to zero. Javadoc
|
|
||
| @Override | ||
| public long skip(final long n) throws IOException { | ||
| charsRead += n; |
Check failure
Code scanning / CodeQL
Implicit narrowing conversion in compound assignment High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 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 (
Mathis injava.lang).
Suggested changeset
1
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; | ||
| } | ||
| } |
Copilot is powered by AI and may make mistakes. Always verify output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.