You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Wang Hailong (Jira)" <ji...@apache.org> on 2024/07/09 08:09:00 UTC

[jira] [Created] (LANG-1745) RandomStringUtils.random encounters neagtive index

Wang Hailong created LANG-1745:
----------------------------------

             Summary: RandomStringUtils.random encounters neagtive index 
                 Key: LANG-1745
                 URL: https://issues.apache.org/jira/browse/LANG-1745
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 3.14.0
         Environment: jdk18
            Reporter: Wang Hailong


when RandomStringUtils.random encounters negative index it just keep running all the time(like meeting a dead loop?), hope to raise an exception

the test code is :
{color:#bbb529}@Test
{color}{color:#cc7832}public void {color}{color:#ffc66d}testNegativeRange{color}() {
{color:#cc7832}int {color}start = Integer.{color:#9876aa}MIN_VALUE{color}{color:#cc7832};
{color}{color:#cc7832} int {color}end = -{color:#6897bb}10{color}{color:#cc7832};
{color}{color:#cc7832}
{color}{color:#cc7832} {color}{color:#808080}// Generate a random character with negative range parameters
{color}{color:#808080} {color}String result = RandomStringUtils.random({color:#6897bb}1{color}{color:#cc7832}, {color}start{color:#cc7832}, {color}end{color:#cc7832}, false, false, null{color}){color:#cc7832};
{color}{color:#cc7832}
{color}}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)