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

Zhijie Shen commented on HADOOP-9869:
-------------------------------------

bq. Both getEnum() and getPattern() don't set String, so they don't have a need 
to be trimmed.

IMHO, not exactly. If the string is not trimmed:

1. getEnum: if we have enum MyEnum \{FOO\} and test.enum=FOO_, where _ is a 
space character, getEnum("test.enum", MyEnum.FOO) will throw 
IllegalArgumentException, which is originated from Enum.valueOf().

2. getPatter: if test.pattern=_a\{4\}, getPattern("test.pattern", 
defaultPattern) will get the pattern that cannot match the string "aaaa".

However, it's still arguable. For example, the user in particular want the 
whitespace to be part of the string. He wants to parse MyEnum \{FOO("FOO ")\} 
and match " aaaa". Anyway, my feeling is that the whitespace can be caused more 
by mistake than by intention.
                
>  Configuration.getSocketAddr() should use getTrimmed()
> ------------------------------------------------------
>
>                 Key: HADOOP-9869
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9869
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 3.0.0, 2.1.0-beta, 1.3.0
>            Reporter: Steve Loughran
>            Assignee: Tsuyoshi OZAWA
>            Priority: Minor
>         Attachments: HADOOP-9869.1.patch
>
>
> YARN-1059 has shown that the hostname:port string used for the address of 
> things like the RM isn't trimmed before its parsed, leading to errors that 
> aren't that obvious. 
> We should trim it -it's clearly not going to break any existing (valid) 
> configurations

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to