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

James Sawle commented on LANG-1043:
-----------------------------------

The main problem with the current method, is that it does not fulfil the 
Ronseal test. The fact that the method is looking at non-letter characters and 
determining them as non-uppercase even though there is no definition for them 
for this, seems arbitrary. 

There are a number of use-cases such as a persons full name, which you may wish 
to check was provided in uppercase but would also contain a space, and 
therefore this method would have be used in conjunction with a split around 
spaces, and then double-barrel surnames would case it to fail. Or unique 
identifiers for products, which may contain numbers as well as letters, where 
only products with all capital letter values (excluding the numbers) should be 
sold to the public.

Personally, I would prefer to see this taken a step further, with the 
definition of the original method to take this behaviour as standard, and for 
the current behaviour, call the redefined method as well as 
StringUtils.isAlpha. A new method could be created to wrap this two calls to 
ease the migration. However, I understand that this would break backwards 
compatibility and therefore could not be placed in until version 4 if at all.

> isAllUpperCase should only check Alpha characters
> -------------------------------------------------
>
>                 Key: LANG-1043
>                 URL: https://issues.apache.org/jira/browse/LANG-1043
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.3.2
>            Reporter: Frédéric JECKER
>             Fix For: Discussion
>
>         Attachments: LANG-1043.patch
>
>
> Currently, isAllUpperCase checks character by character if the current 
> character is UpperCase or not using Character.isUpperCase().
> The problem is that characters like spaces aren't considered as uppercase 
> characters.
> IMHO, isAllUpperCase should only check the state of alpha characters so that :
> - StringUtils.isAllUpperCase("ABC DEF GHI") = true (false currently)
> - StringUtils.isAllUpperCase("ABC / DEF") = true (false currently)



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

Reply via email to