[ https://issues.apache.org/jira/browse/CONFIGURATION-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bourg updated CONFIGURATION-6: --------------------------------------- Fix Version/s: 1.2 Environment: (was: Operating System: other Platform: All) > [configuration] XMLConfiguration inconsistency towards empty values > ------------------------------------------------------------------- > > Key: CONFIGURATION-6 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-6 > Project: Commons Configuration > Issue Type: Bug > Affects Versions: 1.1 > Reporter: Etienne Lacazedieu > Fix For: 1.2 > > > 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]