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

Harsh J commented on HADOOP-8362:
---------------------------------

Hi,

Thanks for the patches!

Some comments from my side:
- Better to use IllegalArgumentException instead of the raw RuntimeException.
- Perhaps we can check for this very early (first step) into the set() call. 
Perhaps better to be done via Guava's 
http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Preconditions.html#checkArgument(boolean,%20java.lang.Object)
 call, rather than duplicating code. We already have Guava added in as a 
dependency, makes sense to leverage it where we can for its free benefits.
- Please also document the behavior of sending in nulls inside the set call's 
javadocs, so users can benefit from it (by knowing what to expect).
- Test is good, but also good to assert that the exception object is the right 
one, and that the message is proper. Helps avoid regressions in future.
                
> Improve exception message when Configuration.set() is called with a null key 
> or value
> -------------------------------------------------------------------------------------
>
>                 Key: HADOOP-8362
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8362
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 2.0.0
>            Reporter: Todd Lipcon
>            Priority: Trivial
>              Labels: newbie
>         Attachments: HADOOP-8362-1.patch, HADOOP-8362.patch
>
>
> Currently, calling Configuration.set(...) with a null value results in a 
> NullPointerException within Properties.setProperty. We should check for null 
> key/value and throw a better exception.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to