alhudz opened a new pull request, #1808: URL: https://github.com/apache/commons-lang/pull/1808
`Repro:` `RandomStringUtils.insecure().nextGraph(20)` (or `nextPrint(20)`) over a large sample never yields `'~'` (`0x7E`); the highest code point produced is `'}'` (`0x7D`). `Cause:` both methods call the core `random(count, start, end, ...)` where `end` is **exclusive**, but pass `end` `126`. So the range effectively stops at `0x7D`. Their Javadoc documents the full POSIX `[:graph:]` (`0x21`..`0x7E`) and `[:print:]` (`0x20`..`0x7E`) sets, and the sibling `nextAscii(int)` already passes `127` to include `0x7E`, so the three are inconsistent. `Fix:` pass `end` `127` at both sites. The `(minLengthInclusive, maxLengthExclusive)` overloads and the static `randomGraph`/`randomPrint` delegate to these, so they are covered without further change. Confirmed with a 400k-character sample: max char `0x7D` before, `0x7E` after. Added `RandomStringUtilsTest` boundary-coverage tests (mirroring the existing `testRandomAscii`) that fail before and pass after. - [x] Read the [contribution guidelines](https://github.com/apache/commons-lang/blob/master/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. Which AI tool was used to create this pull request, and to what extent did it contribute? Claude Code (Anthropic's Claude) was used to help locate the off-by-one, apply the fix, and write the regression tests and this description; I reviewed and verified everything against the build. - [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. This may not always be possible, but it is a best practice. - [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. Note that a maintainer may squash commits during the merge process. -- 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]
