hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-4416) class names in Configuration are not resolved if the configuration value has a white space
Date Fri, 24 Oct 2008 10:57:44 GMT

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

Steve Loughran commented on HADOOP-4416:
----------------------------------------

Looking at the patch,


1. You need tests of the default handling. The get operations are all calling .trim() before
checking for the result being null; as a result they will probably NPE rather than return
defaults

e.g, what happens on conf.getLong("undefined-key",23);

   public long getLong(String name, long defaultValue) {
-    String valueString = get(name);
+    String valueString = get(name).trim();
     if (valueString == null)
       return defaultValue;

2. I'd recommend the trim operation is made a (protected?) method in Configuration

protected String trim(String source) {
 return source==null?source:source.trim();
}

One place to keep the logic, one test for null handling might suffice 


3. the {{.toLowerCase()}} operation for getBoolean should be made locale neutral, by adding
a locale parameter:
{{toLowerCase(Locale.EN_US)}}

4. Also, getBoolean shouldn't do any toLowerCase() operations on null values. 

5. The changes to getBoolean() change the semantics of the operation. Currently

 bool b=conf.getBoolean("something",false"); returns false if "something" is set to "TRUE"
in the file. With the case change, it will evaluate to true. I don't know if this matters,
but it isn't completely backwards compatible. 

> class names in Configuration are not resolved if the configuration value has a white
space 
> -------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-4416
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4416
>             Project: Hadoop Core
>          Issue Type: Bug
>         Environment: all
>            Reporter: Alejandro Abdelnur
>            Assignee: Abhijit Bagri
>         Attachments: HADOOP-4416-v2.patch, HADOOP-4416.patch
>
>
> If an entry in the configuration used for a class contains spaces or enters before or
after the {{getClass}} and {{getClasses}} methods fail to resolve the class.
> For example:
> {code}
>     <property>
>         <name>mapred.mapper.class</name>
>         <value>
>           com.foo.MyMapper
>         </value>
>     </property>
> {code}

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


Mime
View raw message