Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-11199

Configuration should be able to set empty value for property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • conf
    • None

    Description

      Currently in hadoop.common.conf.Configuration, when you specify a XML like this:

      <configuration>
        <property>
          <name>conf.name</name>
          <value></value>
        </property>
      </configuration>
      

      When you trying to get the conf.name, the returned value is null instead of an empty string.

      Test code for this,

      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"));
        }
      }
      

      Does this intentionally or a behavior should be fixed?

      Attachments

        1. HADOOP-11199-01.patch
          3 kB
          Ray Chiang

        Issue Links

          Activity

            People

              Unassigned Unassigned
              leftnoteasy Wangda Tan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: