[ 
https://issues.apache.org/jira/browse/LANG-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15659193#comment-15659193
 ] 

Duncan Jones edited comment on LANG-1284 at 11/12/16 7:22 AM:
--------------------------------------------------------------

I'm not sure if this can be prevented without very inefficient scanning of the 
input array. Perhaps the best approach here is a warning in the Javadocs.

The Javadocs need a clean up anyway, I can't really understand the opening 
paragraphs:

{quote}
If start and end are both 0, start and end are set to ' ' and 'z', the ASCII 
printable characters, will be used, unless letters and numbers are both false, 
in which case, start and end are set to 0 and Integer.MAX_VALUE.

If set is not null, characters between start and end are chosen.{quote}


was (Author: dmjones500):
I'm not sure if this can be prevented with very inefficient scanning of the 
input array. Perhaps the best approach here is a warning in the Javadocs.

The Javadocs need a clean up anyway, I can't really understand the opening 
paragraphs:

{quote}
If start and end are both 0, start and end are set to ' ' and 'z', the ASCII 
printable characters, will be used, unless letters and numbers are both false, 
in which case, start and end are set to 0 and Integer.MAX_VALUE.

If set is not null, characters between start and end are chosen.{quote}

> RandomStringUtils' random method goes into an infinite loop
> -----------------------------------------------------------
>
>                 Key: LANG-1284
>                 URL: https://issues.apache.org/jira/browse/LANG-1284
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Arul Nedumaran
>
> The following code goes into an infinite loop.
> {code}
> RandomStringUtils.random(1, 0, 0, false, true, new char[]{ 'a' })
> {code}
> I know it doesn't make sense to pass letters=false and then a letter array, 
> but a bug in the caller's code will make him fall into this trap.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to