commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Sawle (JIRA)" <>
Subject [jira] [Commented] (LANG-1043) isAllUpperCase should only check Alpha characters
Date Thu, 09 Oct 2014 08:05:33 GMT


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:
>             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

View raw message