Emmanuel Bourg wrote on Friday, March 05, 2004 1:27 PM:
> J�rg Schaible wrote:
>
>> Looking at the changes for teh test cases, I have the impression that
>>
>> conf.setProperty("x.y.z", "1");
>> subset = conf.subset("x.y.z.not_there");
>>
>> will also return an empty configuration, whereas this return value
>> was previously always just null.
>
> Yes indeed, but since the subset is now synchronized with the parent
> configuration I think it's better to return an empty
> configuration, thus
> you can add new keys to the parent through a subset. For example :
>
> Configuration config = new BaseConfiguration();
> Configuration subset = config.subset("database");
> subset.setProperty("driver", "oracle.jdbc.driver.OracleDriver");
> subset.setProperty("url", "jdbc:oracle:thin:@host:1521:service");
> subset.setProperty("username", "foo");
> subset.setProperty("password", "bar");
>
> config.getProperty("database.driver");
Sure, but here is the compatibility issue:
Configuration config = new BaseConfiguration();
Configuration subset = config.subset("database");
if(subset == null) {
// continue with limited functionality
} else {
jdbc.connect(subset.getProperty("database").toString());
}
===> an existing app may just fail now with NPE
But I admit that your example above look smart though :)
Regards,
J�rg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]