[
https://issues.apache.org/jira/browse/LANG-1772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved LANG-1772.
-----------------------------------
Fix Version/s: 3.18.0
Resolution: Fixed
[~jwinters]
The PR was merged to git master. Please test git master or a snapshot build
from the Maven repository
https://repository.apache.org/content/repositories/snapshots/
TY!
> Since 3.17.0 you cannot create huge random strings because of overflow errors
> -----------------------------------------------------------------------------
>
> Key: LANG-1772
> URL: https://issues.apache.org/jira/browse/LANG-1772
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.17.0
> Reporter: James Winters
> Priority: Minor
> Fix For: 3.18.0
>
>
> Since 3.17.0, and the new CachedRandomBits implementation, it is no longer
> possible to create random strings longer than about 60M characters. It's not
> exact, as the overflow will happen at a random point depending on the number
> of rejections.
> The test below will always generate an
> java.lang.ArrayIndexOutOfBoundsException: Index -268435456 as the int wraps
> around due to rejections
>
> {code:java}
> @Test
> public void testHugeStrings() {
> final int expectedLength = 64_000_000;
> final String hugeString = RandomStringUtils.random(expectedLength);
> assertEquals(expectedLength, hugeString.length(), "hugeString.length() ==
> expectedLength");
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)