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

Konstantin Shvachko commented on HADOOP-11602:
----------------------------------------------

Thanks for clarifying, guys.

>  it's difficult to call Locale.setDefault in proper places.

- So if I understand it correctly from JavaDoc of 
[Locale.setDefault()|http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#setDefault%28java.util.Locale.Category,%20java.util.Locale%29]
 it sets the default for the entire JVM (but not the host). This means that we 
could called {{setDefault()}} anywhere we start the services: {{NameNode}}, 
{{DataNode}}, {{Balancer}}, etc., or clients {{FileSystem}}, or other tools 
{{ToolRunner}}. I did not test it, but seems to be feasible.
- If we nevertheless had to go and change all {{toUpperCase}} / 
{{toLowerCase()}} I would still try to do it via a utility methods, like
{code}
public static String StringUtils.toLowerCase(String s) {
  return s.toLowerCase(Locale.ENGLISH);
}
{code}
So that if anybody needs to change it again it was a on line change rather than 
540 line change.

> Fix toUpperCase/toLowerCase to use Locale.ENGLISH
> -------------------------------------------------
>
>                 Key: HADOOP-11602
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11602
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Tsuyoshi OZAWA
>            Assignee: Tsuyoshi OZAWA
>         Attachments: HADOOP-11602-001.patch, HADOOP-11602-002.patch, 
> HADOOP-11602-branch-2.001.patch
>
>
> String#toLowerCase()/toUpperCase() without a locale argument can occur 
> unexpected behavior based on the locale. It's written in 
> [Javadoc|http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#toLowerCase()]:
> {quote}
> For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", 
> where '\u0131' is the LATIN SMALL LETTER DOTLESS I character
> {quote}
> This issue is derived from HADOOP-10101.



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

Reply via email to