DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35963>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35963

           Summary: XMLConfiguration inconsistency towards empty values.
           Product: Commons
           Version: 1.1 Final
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Configuration
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Empty values are not read correctly from XML files : when a XML file contains an
empty element, the corresponding keys are not present in the configuration, but
an empty string can be saved!

Consider the following code : 

XMLConfiguration config = new XMLConfiguration();
config.setProperty("foo.bar", "");
config.save("config.xml");
System.out.println("Config saved!");
System.out.println("foo.bar in config1 = "+config.getProperty("foo.bar"));
XMLConfiguration config2 = new XMLConfiguration("config.xml");
System.out.println("foo.bar in config2= "+config2.getProperty("foo.bar"));

The output is : 

foo.bar in config1 = ''
foo.bar in config2 = 'null'

the file config.xml contains : 

<configuration>
    <foo>
         <bar/>
    </foo>
</configuration>

this also does not allow to distinguish between an empty value and a missing 
key.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to