commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-460) reloadStrategy does not work for files inside <additional> tag using DefaultConfigurationBuilder
Date Sun, 14 Aug 2011 20:34:27 GMT


Oliver Heger commented on CONFIGURATION-460:

The problem is probably caused by the structure of the combined configuration produced by
* There is one {{CombinedConfiguration}} which stores all properties. It is configured by
properties in the _result_ section.
* For configuration sources declared in the _additional_ section another {{CombinedConfiguration}}
is created and added to the first {{CombinedConfiguration}}. This configuration, however,
is currently not fully initialized. Especially the _forceReloadCheck_ property is not set.
Therefore reloads are not detected.

A fix for this issue has to ensure that some of the properties defined for the result configuration
are also set for the configuration for the additional sources.

> reloadStrategy does not work for files inside <additional> tag using DefaultConfigurationBuilder
> ------------------------------------------------------------------------------------------------
>                 Key: CONFIGURATION-460
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 1.6
>         Environment: Linux x86_64
>            Reporter: Azfar Kazmi
> In the configuration file that DefaultConfigurationBuilder reads to build a CombinedConfiguration,
it's possible to include configuration file either inside <override> or <additional>
xml elements.
> Each such declaration, of a file, allows a realodStrategy to be specified (see example
below). It appears that the reload occurs only for the files inside <override> and not
for the ones inside <additional>.
> Example:
> <configuration>
>   <header>
>     <result forceReloadCheck="true">
>       <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
>     </result>
>   </header>
>   <override>
>     <properties fileName="" config-optional="true">
>       <reloadingStrategy refreshDelay="100"
>                          config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
>     </properties>
>   </override>
>   <additional>
>     <properties fileName="">
>       <reloadingStrategy refreshDelay="100"
>                          config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
>     </properties>
>   </additional>
> </configuration>
> In above example, both and are supposed to reload
upon change. However, as tested by the following code, one gets reloaded:
> 		DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder("example.xml");
> 		Configuration conf = dcb.getConfiguration();
> 		System.out.println("user: " + conf.getBoolean("user"));
> 		System.out.println("application: " + conf.getBoolean("application"));
> 		System.out.println("Change files and then press  to continue...");
> 		System.out.println("user: " + conf.getBoolean("user"));
> 		System.out.println("application: " + conf.getBoolean("application"));
> Output from above code:
> user: true
> application: true
> Change files and then press  to continue...
> 0 [main] INFO org.apache.commons.configuration.PropertiesConfiguration  - Reloading configuration.
URL is file:<snipped>/
> user: false
> application: true

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message