[
https://issues.apache.org/jira/browse/HADOOP-11199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14179682#comment-14179682
]
Wangda Tan commented on HADOOP-11199:
-------------------------------------
[~rchiang], thanks for you patch,
Actually, I don't think this is intentional, because we cannot set an empty
value instead of null for a key in configuration. And the empty value
configuration should be a determinate behavior instead of a configurable one,
there's complete different semantics between empty and null. I think if a
existing module rely on behavior today should be updated. Do you have any
example for configs rely on this?
Thanks,
Wangda
> Configuration should be able to set empty value for property
> ------------------------------------------------------------
>
> Key: HADOOP-11199
> URL: https://issues.apache.org/jira/browse/HADOOP-11199
> Project: Hadoop Common
> Issue Type: Bug
> Components: conf
> Reporter: Wangda Tan
> Attachments: HADOOP-11199-01.patch
>
>
> Currently in hadoop.common.conf.Configuration, when you specify a XML like
> this:
> {code}
> <configuration>
> <property>
> <name>conf.name</name>
> <value></value>
> </property>
> </configuration>
> {code}
> When you trying to get the conf.name, the returned value is null instead of
> an empty string.
> Test code for this,
> {code}
> import java.io.ByteArrayInputStream;
> import org.apache.hadoop.conf.Configuration;
> public class HadoopConfigurationEmptyTest {
> public static void main(String[] args) {
> Configuration conf = new Configuration(false);
> ByteArrayInputStream bais =
> new ByteArrayInputStream(("<configuration><property>"
> + "<name>conf.name</name>" + "<value></value>"
> + "</property></configuration>").getBytes());
> conf.addResource(bais);
> System.out.println(conf.get("conf.name"));
> }
> }
> {code}
> Does this intentionally or a behavior should be fixed?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)