You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2012/06/11 19:17:43 UTC

[jira] [Updated] (LANG-808) RandomStringUtils inefficient init of start and end for letters and numbers; misleading Javadoc

     [ https://issues.apache.org/jira/browse/LANG-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated LANG-808:
----------------------

          Description: 
If either letters or numbers is true, RandomStringUtils(count, 0, 0, letters, numbers, ...) sets the default start index to space, intending to support the set of printable characters (according to the Javadoc).

However, the code later uses Character.isLetter and Character.isDigit, which exclude space and some other printable characters.

There is currently no direct support for generating printable characters; this would probably require another flag.

The current Javadoc is misleading, and the current code is inefficient because some characters cannot currently be used.

The lowest char which is either digit or letter is '0' (zero).
The lowest char which is a letter is 'A' (upper case a).

The Javadoc for the randomNumeric(int) method says:

bq. Characters will be chosen from the set of numeric characters.

This does not make clear that the numerics are restricted to the ASCII set (because of the way start=end=0 is handled).

Similarly for randomAlphabetic and randomAlphanumeric.

Is it the intention that randomAlphabetic etc. be restricted to ASCII?

  was:
If either letters or numbers is true, RandomStringUtils(count, 0, 0, letters, numbers, ...) sets the default start index to space, intending to support the set of printable characters (according to the Javadoc).

However, the code later uses Character.isLetter and Character.isDigit, which exclude space and some other printable characters.

There is currently no direct support for generating printable characters.

The current Javadoc is misleading, and the current code is inefficient because some characters cannot currently be used.

The lowest char which is either digit or letter is '0' (zero).
The lowest char which is a letter is 'A' (upper case a).

    Affects Version/s: 2.6
                       3.1
              Summary: RandomStringUtils inefficient init of start and end for letters and numbers; misleading Javadoc  (was: RandomStringUtils inefficient init of start and end for letters and numbers)
    
> RandomStringUtils inefficient init of start and end for letters and numbers; misleading Javadoc
> -----------------------------------------------------------------------------------------------
>
>                 Key: LANG-808
>                 URL: https://issues.apache.org/jira/browse/LANG-808
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.6, 3.1
>            Reporter: Sebb
>
> If either letters or numbers is true, RandomStringUtils(count, 0, 0, letters, numbers, ...) sets the default start index to space, intending to support the set of printable characters (according to the Javadoc).
> However, the code later uses Character.isLetter and Character.isDigit, which exclude space and some other printable characters.
> There is currently no direct support for generating printable characters; this would probably require another flag.
> The current Javadoc is misleading, and the current code is inefficient because some characters cannot currently be used.
> The lowest char which is either digit or letter is '0' (zero).
> The lowest char which is a letter is 'A' (upper case a).
> The Javadoc for the randomNumeric(int) method says:
> bq. Characters will be chosen from the set of numeric characters.
> This does not make clear that the numerics are restricted to the ASCII set (because of the way start=end=0 is handled).
> Similarly for randomAlphabetic and randomAlphanumeric.
> Is it the intention that randomAlphabetic etc. be restricted to ASCII?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira