You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Wangda Tan (JIRA)" <ji...@apache.org> on 2014/10/14 01:59:33 UTC

[jira] [Created] (HADOOP-11199) Configuration should be able to set empty value for property

Wangda Tan created HADOOP-11199:
-----------------------------------

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


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)