You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/08/01 17:44:41 UTC

DO NOT REPLY [Bug 35963] New: - XMLConfiguration inconsistency towards empty values.

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: commons-dev@jakarta.apache.org
        ReportedBy: e.lacazedieu@lectra.com


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org