jakezwang opened a new pull request, #879:
URL: https://github.com/apache/commons-io/pull/879

   Fixes [IO-893](https://issues.apache.org/jira/browse/IO-893).
   
   `BOMInputStream` eagerly buffers the first bytes in its constructor. 
Resetting a `ByteArrayInputStream` before an explicit `mark()` rewinds the 
delegate to zero, but previously replayed the old buffer as well, duplicating 
the prefix and potentially including an excluded BOM.
   
   Rebuild the initial buffer after an implicit reset and preserve the existing 
buffered-position behavior for explicit marks. Tests cover BOM 
inclusion/exclusion, no BOM, short input, and repeated resets. A field-specific 
SpotBugs exclusion reflects the class's documented lack of thread safety.
   
   Validation: default `mvn` on JDK 21 passed (6,621 tests, 33 skipped), 
including RAT, API compatibility, Checkstyle, SpotBugs, PMD and Javadoc. All 
five new regression cases fail without the fix.
   
   - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
   - [x] Read the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html) if you use 
Artificial Intelligence (AI).
   - [x] I used AI to create any part of, or all of, this pull request. Codex 
prepared the code, tests and description and ran validation.
   - [x] Run a successful build using the default 
[Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command 
line by itself.
   - [x] Write unit tests that match behavioral changes, where the tests fail 
if the changes to the runtime are not applied.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body.
   


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