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

Mike Baranczak commented on HADOOP-6948:
----------------------------------------

> Can you perhaps humor me and elaborate a bit more how it comes that you have 
> properties that you need to erase?

If you need to dynamically override a default property, AND there's a semantic 
difference between a null and an empty value, then the lack of the remove 
capability could be a problem.

Suppose we're writing a custom Nutch plugin. It implements a white-list filter 
of some sort; we pass it a list of values that are allowed. If the list is 
empty, it means that nothing is allowed. But if there is no list, then the 
filtering is disabled, and everything is allowed. If the white-list is not set 
by default, then this scheme works fine. But if there is a default in one of 
the XML files, then we can't unset it, we can only set it to an empty string.


> Changing a datastructure from write-only to read-write means that 
> applications can less safely cache values from it. But since Configuration is 
> already permits overwrites this is perhaps a non-issue.

Exactly; it's already a read-write class.


> Also, do you intend to provide a patch for this?

I can if you want. Let me know what the requirements are as far as unit testing.


> My instinct is that, if we were to provide the ability to remove 
> Configuration properties, it should be done through a 'remove' method rather 
> than by setting values to null.

Agreed.


> There's no way to remove a property from a Configuration
> --------------------------------------------------------
>
>                 Key: HADOOP-6948
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6948
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.20.2, 0.21.0
>         Environment: all
>            Reporter: Mike Baranczak
>            Priority: Minor
>
> The Configuration class has a lot of methods for setting properties, but it's 
> impossible to remove a property once it's set. Trying to set it to null 
> results in a NullPointerException, since java.util.Properties doesn't allow 
> null values. When building a Configuration programmatically, this can be a 
> problem. 

-- 
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