ETF-7 opened a new pull request, #919:
URL: https://github.com/apache/commons-io/pull/919

   BoundedReader inherits read(char[]) and read(CharBuffer) from ProxyReader. 
Both inherited methods delegate directly to the wrapped reader, bypassing 
BoundedReader's limit and character count. For example, IOUtils.copy(new 
BoundedReader(new StringReader("01234567890"), 3), writer) currently copies all 
11 characters instead of 3.
   
   Override both overloads so that they use the existing bounded read paths. 
Preserve the destination CharBuffer position and reject a read-only buffer 
before consuming input. Regression tests cover array reads, heap and direct 
CharBuffers, mixed read calls, EOF and empty destinations, read-only buffers, 
and IOUtils.copy.
   
   Related to [SLING-13268](https://issues.apache.org/jira/browse/SLING-13268), 
where the downstream workaround replaced BoundedReader after it stopped 
enforcing the bound with IOUtils.copy. This PR addresses the upstream reader 
behavior.
   
   Validation on Windows with Java 21 and Maven 3.9.6:
   
   - Before the implementation change, `mvn -B -ntp -Dtest=BoundedReaderTest 
test` ran 25 tests with 5 failures, demonstrating the regression.
   - With the fix, the same command passed all 25 tests.
   - `mvn -B -ntp -DskipTests -DskipITs` passed the default build and non-test 
checks, including RAT, binary compatibility, Checkstyle, SpotBugs, PMD, and 
Javadoc.
   - The full default `mvn -B -ntp` run completed with 7,315 tests, 3 failures, 
60 errors, and 51 skipped. The failures/errors were caused by missing Windows 
symbolic-link privileges and one HTTPS handshake failure in URIOriginTest. 
BoundedReaderTest passed in this run. The full default build is therefore left 
unchecked below.
   - The published branch was fetched and compared against the tested local 
files; both files match exactly.
   
   AI disclosure: OpenAI Codex generated the implementation, regression tests, 
commit descriptions, and this PR description, and performed repository 
inspection and validation. Both commits include `Assisted-By: OpenAI Codex`.
   
   - [x] Read the [contribution 
guidelines](https://github.com/apache/commons-io/blob/master/CONTRIBUTING.md).
   - [x] Read the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html).
   - [x] I used AI to create part or all of this pull request; tool and extent 
are disclosed above.
   - [ ] Run a successful build using the default Maven goal with `mvn` 
(environment limitations described above).
   - [x] Write unit tests that match behavioral changes and fail without the 
implementation changes.
   - [x] Write a description explaining what, how, and why.
   - [x] Use meaningful commit subjects and bodies.


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