commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35963] New: - XMLConfiguration inconsistency towards empty values.
Date Mon, 01 Aug 2005 15:44:41 GMT
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


Mime
View raw message