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

Sreekanth Ramakrishnan commented on HADOOP-4212:
------------------------------------------------

I think we should have a generic way of reading values than to expect each 
implementer of new getXXX() method in Configuration or a class which subclasses 
configuration to remember he has to deal with a leading or a trailing space.

bq. In addition to resolving class names, it would be reasonable to trim values 
interpreted in getInt, getLong, etc., though it would still be an incompatible 
change
As per the suggestion all  that remains untouched in the Configuration getXXX 
methods are getLocalPath() and getFile(). I still feel that getString() method 
should be trimmed and be passed to the user. For I have one use case which I am 
mentioning here:


An HADOOP administrator configures a job queue: with name A and accidentially 
adds a space at the end.

User looks at the ./hadoop queue list and finds out there is a job queue A, and 
does not notice the extra space which is hidden in output in console and in 
web. And mentions in his jobconf to submit to job queue A, the system checks 
for queue information in job sees that there is no queue called A(without space 
i.e.) and submits the job to the default queue. Which is wrong.

You might argue that as an implementer, I should do checking with trimming the 
space, but then again this can cause bugs to due accidental mis-configuration. 
I would lean in towards trimming the space unless explicitly mentioned not to 
for getString method.

> New lines and leading spaces are not trimmed of a value when configuration is 
> read
> ----------------------------------------------------------------------------------
>
>                 Key: HADOOP-4212
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4212
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: conf
>    Affects Versions: 0.18.1
>         Environment: Generic
>            Reporter: Sreekanth Ramakrishnan
>            Assignee: Sreekanth Ramakrishnan
>            Priority: Minor
>         Attachments: HADOOP-4212-1.patch, HADOOP-4212-TESTCASE.patch
>
>
> While configuration value is read the leading and trailing spaces and new 
> line characters are taken into account.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to