ConfigurationConverter doesn't seem to respect the ordering of a composite configuration. I am having problems describing the behavior, but I thinks the following test case illustrates it best:
@Test
public void showBug() {
PropertiesConfiguration p = new PropertiesConfiguration();
p.addProperty("foo", "initial");
p.addProperty("bar", "${foo}");
p.addProperty("prefix.foo", "override");
CompositeConfiguration cfg = new CompositeConfiguration();
cfg.addConfiguration(p.subset("prefix"));
cfg.addConfiguration(p);
// this assertion passes as expected since the subset
// was added first to the composite configuration
Assert.assertEquals("override", cfg.getString("bar"));
// after converting to properties, this assertion fails and
// reports that the value is 'initial'
Properties properties = ConfigurationConverter.getProperties(cfg);
Assert.assertEquals("override", properties.getProperty("bar"));
}
The first of these interpolations is pointless because the second one will produce the desired results.
Because getStringArray() delegates to getList() this method is affected, too. In fact getStringArray() does again an interpolation on the values returned by getList(). Because getList() should already have substituted all variables for which this is possible, this additional interpolation won't add any value.