[
https://issues.apache.org/jira/browse/HADOOP-10625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14011754#comment-14011754
]
Wangda Tan commented on HADOOP-10625:
-------------------------------------
Thanks [~xgong] for reviewing this!
> 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
> Assignee: Wangda Tan
> Fix For: 2.5.0
>
> Attachments: HADOOP-10625.patch, HADOOP-10625.patch,
> 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)