commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] CombinedConfiguration.getSource()
Date Sat, 08 Nov 2008 16:11:42 GMT
ralph.goers schrieb:
> I don't understand why getSource throws an Exception when a property can be
> found in multiple configurations. If the property is not a list or if
> escaping is disabled then the value from the first Configuration the key is
> found in will be used. Shouldn't an Exception only be thrown when the value
> is constructed by merging values from two Configurations? (This only seems
> to happen if a String with the escape character is present). I'm writing a
> class that extends CombinedConfiguration and I wanted to changed this
> behavior so that it works that way but unfortunately findSourceConfiguration
> is private instead of protected so I can't reimplement getSource without
> also reimplementing findSourceConfiguration.

The getSource() method was added on behalf of CONFIGURATION-215 [1]. The 
original request was a bit adapted to come to a more generic solution. 
IIRC the usage scenario was that you have multiple child configurations 
with different name spaces and want to uniquely identify the child 
configuration that added a specific key. If multiple child 
configurations define the key in question, no unique source can be 
identified; hence the exception.

Do you propose making findSourceConfiguration() protected? I did not do 
this in the past because I was not sure whether there would be another 
use case for this method and I wanted to keep the API lean. But if you 
need it, I am not against this change.



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

View raw message