Akshat-coder2106 opened a new pull request, #1529: URL: https://github.com/apache/commons-lang/pull/1529
## What does this PR do? This pull request fixes **LANG-1801** by validating the `start` and `end` parameters in `RandomStringUtils.random()` when a custom `chars` array is provided. Previously, invalid values for `start` or `end` could result in an `ArrayIndexOutOfBoundsException`. This change ensures that such invalid inputs are detected early and an `IllegalArgumentException` is thrown instead, which matches the documented method contract. ## How was this implemented? - Added explicit validation of `start` and `end` when `chars != null` - Ensured invalid ranges are rejected with `IllegalArgumentException` - Added unit tests to cover invalid `start` / `end` scenarios ##Checklist - [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). - [x] I used AI (ChatGPT) for guidance and explanations; all code and tests were written and reviewed by me. - [x] Ran a successful build using the default Maven goal (`mvn`). - [x] Added unit tests that fail without the fix and pass with the fix applied. - [x] Provided a clear pull request description explaining what, how, and why. - [x] Commits have meaningful subject lines and are related to LANG-1801. -- 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]
