commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Stevanovic <>
Subject [configuration] inconsistent behaving of AbstractHierarchicalFileConfiguration.containsKey(String) method
Date Thu, 09 Jun 2011 09:27:48 GMT
I'm using the following code:

XMLConfiguration config= new XMLConfiguration();
config.setExpressionEngine(new XPathExpressionEngine());
if (f.exists()) {

config.addProperty(" a", "");
config.addProperty("a b", "");
config.addProperty("a/b c", "");;
System.out.println("a is a valid key " + config.containsKey("a"));
System.out.println("a/b is a valid key " + config.containsKey("a/b"));
System.out.println("a/b/c is a valid key " + config.containsKey("a/b/c"));

After executing it for the first time, the code behaves as I expected,
the simple nested xml structure is created and the output is:
a is a valid key true
a/b is a valid key true
a/b/c is a valid key true

Then, I removed the "part2" code, so the program should just read the
previously created configuration, bat the output was:
a is a valid key false
a/b is a valid key false
a/b/c is a valid key true

So, sometimes if key doesn't have any values it is seen as a key, and
sometimes not. Any explanation, solution,... ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message