You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by sam iam <sa...@live.com> on 2012/02/26 09:19:55 UTC
[configuration] Variable interpolation across files broken
Hi, With Commons Configuration 1.6, I was able to declare a variable in a properties file, and then reference it in a XML file using the ${myvar} syntax. For example: global.properties-----myvar=abc test.xml-----<products>
<product name="abc">
<desc>${myvar}-product</desc>
</link></product> config.xml-----<properties fileName="global.properties"/><xml fileName="test.xml" config-name="test" validating="true">
<expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
<reloadingStrategy refreshDelay="5000" config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
</xml>
When I try to retrieve the value, like so: combinedConfig.getConfiguration("test").configurationAt("products/product[@name='abc']", true).getString("desc") I get "${myvar}-product" instead of "abc-product". This was working in Commons Configuration 1.6, but seems to be broken in 1.7 and 1.8. Did something change, or is there a different way to do this? Or is this a bug?
Re: [configuration] Variable interpolation across files broken
Posted by Oliver Heger <ol...@oliver-heger.de>.
Am 26.02.2012 09:19, schrieb sam iam:
>
>
>
>
> Hi, With Commons Configuration 1.6, I was able to declare a variable in a properties file, and then reference it in a XML file using the ${myvar} syntax. For example: global.properties-----myvar=abc test.xml-----<products>
> <product name="abc">
> <desc>${myvar}-product</desc>
> </link></product> config.xml-----<properties fileName="global.properties"/><xml fileName="test.xml" config-name="test" validating="true">
> <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
> <reloadingStrategy refreshDelay="5000" config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
> </xml>
> When I try to retrieve the value, like so: combinedConfig.getConfiguration("test").configurationAt("products/product[@name='abc']", true).getString("desc") I get "${myvar}-product" instead of "abc-product". This was working in Commons Configuration 1.6, but seems to be broken in 1.7 and 1.8. Did something change, or is there a different way to do this? Or is this a bug?
This seems to be a regression between versions 1.6 and 1.7. Could you
please open a ticket in our bug tracking system [1]? Please attach your
test configuration files so we can reproduce the problem.
Thanks!
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org