[
https://issues.apache.org/jira/browse/LANG-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrzej Winnicki updated LANG-902:
----------------------------------
Description:
Either there is a bug in an implementation or misunderstanding in docs.
RandomStringUtils.random (count, letters, numbers) is documented so that:
letters if true, generated string *will* include alphabetic characters
numbers if true, generated string *will* include numeric characters
But apparently the current implementation supports only that generated string
*may* include either only letters, only numbers or both.
This is current implementation:
if (letters && Character.isLetter(ch) || numbers && Character.isDigit(ch) ||
!letters && !numbers)
So there may be situation when generated string is not containing numbers at
all which is in contrary with what the docs say.
was:
Either there is a bug in an implementation or misunderstanding in docs.
RandomStringUtils.random (count, letters, numbers) is documented so that:
letters if true, generated string *will* include alphabetic characters
numbers if true, generated string *will* include numeric characters
But apparently the current implementation supports only that generated string
*may* include either only letters, only numbers or both.
This is current implementation:
if (letters && Character.isLetter(ch)
|| numbers && Character.isDigit(ch)
|| !letters && !numbers)
So there may be situation when generated string is not containing numbers at
all which is in contrary with what the docs say.
> RandomStringUtils.random (count, letters=true, number=true) may not use
> numerics
> --------------------------------------------------------------------------------
>
> Key: LANG-902
> URL: https://issues.apache.org/jira/browse/LANG-902
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.1
> Reporter: Andrzej Winnicki
> Priority: Minor
> Labels: random
>
> Either there is a bug in an implementation or misunderstanding in docs.
> RandomStringUtils.random (count, letters, numbers) is documented so that:
> letters if true, generated string *will* include alphabetic characters
> numbers if true, generated string *will* include numeric characters
> But apparently the current implementation supports only that generated string
> *may* include either only letters, only numbers or both.
> This is current implementation:
> if (letters && Character.isLetter(ch) || numbers && Character.isDigit(ch) ||
> !letters && !numbers)
> So there may be situation when generated string is not containing numbers at
> all which is in contrary with what the docs say.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira