[
https://issues.apache.org/jira/browse/HADOOP-10625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14007747#comment-14007747
]
Xuan Gong commented on HADOOP-10625:
------------------------------------
+1 LGTM
> Configuration: names should be trimmed when putting/getting to properties
> -------------------------------------------------------------------------
>
> Key: HADOOP-10625
> URL: https://issues.apache.org/jira/browse/HADOOP-10625
> Project: Hadoop Common
> Issue Type: Bug
> Components: conf
> Affects Versions: 2.4.0
> Reporter: Wangda Tan
> Attachments: HADOOP-10625.patch
>
>
> Currently, Hadoop will not trim name when putting a pair of k/v to property.
> But when loading configuration from file, names will be trimmed:
> (In Configuration.java)
> {code}
> if ("name".equals(field.getTagName()) && field.hasChildNodes())
> attr = StringInterner.weakIntern(
> ((Text)field.getFirstChild()).getData().trim());
> if ("value".equals(field.getTagName()) && field.hasChildNodes())
> value = StringInterner.weakIntern(
> ((Text)field.getFirstChild()).getData());
> {code}
> With this behavior, following steps will be problematic:
> 1. User incorrectly set " hadoop.key=value" (with a space before hadoop.key)
> 2. User try to get "hadoop.key", cannot get "value"
> 3. Serialize/deserialize configuration (Like what did in MR)
> 4. User try to get "hadoop.key", can get "value", which will make
> inconsistency problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)