[jira] [Commented] (OFBIZ-10632) ‘String#toLowercase()’ and ‘String#toUppercase()’ should be used when possible

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10632) ‘String#toLowercase()’ and ‘String#toUppercase()’ should be used when possible

Nicolas Malin (Jira)

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

Jacques Le Roux commented on OFBIZ-10632:
-----------------------------------------

Hi Mathieu,

[This is indeed what the Oracle documentation says|https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase--]

It seems this was mostly changed due to [FindBugs reports|https://issues.apache.org/jira/issues/?jql=project%20%3D%20OFBIZ%20AND%20text%20~%20%22added%20a%20default%20Locale%20to%20toLowerCase%22] about [http://findbugs.sourceforge.net/bugDescriptions.html#DM_CONVERT_CASE]

Literally:
{quote} A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the
 * String.toUpperCase( Locale l )
 * String.toLowerCase( Locale l )

versions instead.
{quote}

> ‘String#toLowercase()’ and ‘String#toUppercase()’ should be used when possible
> ------------------------------------------------------------------------------
>
>                 Key: OFBIZ-10632
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10632
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Mathieu Lirzin
>            Priority: Minor
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-10632_Use-String-toLowercase-and-String-toUppercase-when-p.patch
>
>
> Usage of {{"foo".toLowerCase()}} should be preferred to {{"foo".toLowerCase(Locale.getDefault())}} which is equivalent but more verbose. Likewise for {{toUpperCase()}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)