You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Pavel Savara <pa...@intrade.com> on 2008/09/26 14:05:25 UTC
Brackets in key for property file causes exception
Hi,
When we use brackets in property key we get an exception every time.
Escaping brackets with \ doesn't help and i haven't found any mention
that brackets are special characters in documentation
we use common-configuration 1.5
Thanks for help.
Example
#property in property file
test(ef)=false
causes
java.lang.NumberFormatException: For input string: "ef"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at org.apache.commons.configuration.tree.DefaultConfigurationKey
$KeyIterator.checkIndex(DefaultConfigurationKey.java:834)
at org.apache.commons.configuration.tree.DefaultConfigurationKey
$KeyIterator.nextKey(DefaultConfigurationKey.java:511)
at
org.apache.commons.configuration.tree.DefaultExpressionEngine.findNodesForKey(DefaultExpressionEngine.java:462)
at
org.apache.commons.configuration.tree.DefaultExpressionEngine.query(DefaultExpressionEngine.java:286)
at
org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
at
org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:735)
at
org.apache.commons.configuration.ConfigurationUtils.copy(ConfigurationUtils.java:143)
at
org.apache.commons.configuration.ConfigurationUtils.convertToHierarchical(ConfigurationUtils.java:199)
at org.apache.commons.configuration.CombinedConfiguration
$ConfigData.getTransformedRoot(CombinedConfiguration.java:794)
at
org.apache.commons.configuration.CombinedConfiguration.constructCombinedNode(CombinedConfiguration.java:653)
at
org.apache.commons.configuration.CombinedConfiguration.getRootNode(CombinedConfiguration.java:504)
at
org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
at
org.apache.commons.configuration.HierarchicalConfiguration.getProperty(HierarchicalConfiguration.java:327)
at
org.apache.commons.configuration.CombinedConfiguration.getProperty(CombinedConfiguration.java:578)
at
org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:1155)
at
org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1034)
at
org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1017)
www.intrade.com
The Prediction Market
ABOUT US: Intrade is The Prediction Market where members can buy and sell "shares" in financial, political, weather and other important subjects. You can trade using real US$ and you can learn to trade using virtual Intrade I$.
Intrade and the predictive information generated by our members have been featured on CNBC, CNN, Bloomberg, Fox, Fortune & others.
Becoming a member of Intrade gives you profit opportunity and access to the wisdom of a crowd of many thousands of people from over 120 countries.
Intrade News is available on RSS at http://www.intrade.com/news/newsRss.xml
CONFIDENTIALITY & DISCLAIMER: The information within this email is confidential and may be privileged. It is intended solely for party to which it is addressed.
Please notify us immediately if you received this mail in error by returning it to the sender and delete this copy from your system. You should also notify us at +353-1-6200 300.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [configuration] Brackets in key for property file causes
exception
Posted by Pavel Savara <pa...@intrade.com>.
> Unfortunately I don't have a working solution for this problem right
> now. I would like to ask you to create a new ticket in out bug tracking
> system [1], so this issue won't get lost.
Thanks i have done so
https://issues.apache.org/bugzilla/show_bug.cgi?id=45511
Pavel
On Sat, 2008-09-27 at 17:34 +0200, Oliver Heger wrote:
> First of all, please prefix the subject with the name of the component
> you are interest in (as I have done now) because this is a shared list.
> Response below.
>
> Pavel Savara schrieb:
> > Hi,
> > When we use brackets in property key we get an exception every time.
> > Escaping brackets with \ doesn't help and i haven't found any mention
> > that brackets are special characters in documentation
> > we use common-configuration 1.5
> >
> > Thanks for help.
> I guess you use DefaultConfigurationBuilder for loading a combined
> configuration?
>
> The exception is due to the fact that brackets have a special meaning in
> the query syntax for hierarchical configurations.
> (DefaultConfigurationBuilder transforms all configuration sources into
> hierarchical configurations, so also for properties, which are not
> hierarchical by default, the same rules apply.)
>
> So far escaping brackets or other specific characters in property keys
> is not supported. It seems to be rather unusual to use brackets in
> property keys, so you may well be the first one who noticed this problem.
>
> Unfortunately I don't have a working solution for this problem right
> now. I would like to ask you to create a new ticket in out bug tracking
> system [1], so this issue won't get lost.
>
> Thanks
> Oliver
>
> [1] http://commons.apache.org/configuration/issue-tracking.html
> >
> > Example
> >
> > #property in property file
> > test(ef)=false
> >
> > causes
> > java.lang.NumberFormatException: For input string: "ef"
> > at
> > java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> > at java.lang.Integer.parseInt(Integer.java:447)
> > at java.lang.Integer.parseInt(Integer.java:497)
> > at org.apache.commons.configuration.tree.DefaultConfigurationKey
> > $KeyIterator.checkIndex(DefaultConfigurationKey.java:834)
> > at org.apache.commons.configuration.tree.DefaultConfigurationKey
> > $KeyIterator.nextKey(DefaultConfigurationKey.java:511)
> > at
> > org.apache.commons.configuration.tree.DefaultExpressionEngine.findNodesForKey(DefaultExpressionEngine.java:462)
> > at
> > org.apache.commons.configuration.tree.DefaultExpressionEngine.query(DefaultExpressionEngine.java:286)
> > at
> > org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
> > at
> > org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:735)
> > at
> > org.apache.commons.configuration.ConfigurationUtils.copy(ConfigurationUtils.java:143)
> > at
> > org.apache.commons.configuration.ConfigurationUtils.convertToHierarchical(ConfigurationUtils.java:199)
> > at org.apache.commons.configuration.CombinedConfiguration
> > $ConfigData.getTransformedRoot(CombinedConfiguration.java:794)
> > at
> > org.apache.commons.configuration.CombinedConfiguration.constructCombinedNode(CombinedConfiguration.java:653)
> > at
> > org.apache.commons.configuration.CombinedConfiguration.getRootNode(CombinedConfiguration.java:504)
> > at
> > org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
> > at
> > org.apache.commons.configuration.HierarchicalConfiguration.getProperty(HierarchicalConfiguration.java:327)
> > at
> > org.apache.commons.configuration.CombinedConfiguration.getProperty(CombinedConfiguration.java:578)
> > at
> > org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:1155)
> > at
> > org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1034)
> > at
> > org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1017)
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [configuration] Brackets in key for property file causes exception
Posted by Oliver Heger <ol...@oliver-heger.de>.
First of all, please prefix the subject with the name of the component
you are interest in (as I have done now) because this is a shared list.
Response below.
Pavel Savara schrieb:
> Hi,
> When we use brackets in property key we get an exception every time.
> Escaping brackets with \ doesn't help and i haven't found any mention
> that brackets are special characters in documentation
> we use common-configuration 1.5
>
> Thanks for help.
I guess you use DefaultConfigurationBuilder for loading a combined
configuration?
The exception is due to the fact that brackets have a special meaning in
the query syntax for hierarchical configurations.
(DefaultConfigurationBuilder transforms all configuration sources into
hierarchical configurations, so also for properties, which are not
hierarchical by default, the same rules apply.)
So far escaping brackets or other specific characters in property keys
is not supported. It seems to be rather unusual to use brackets in
property keys, so you may well be the first one who noticed this problem.
Unfortunately I don't have a working solution for this problem right
now. I would like to ask you to create a new ticket in out bug tracking
system [1], so this issue won't get lost.
Thanks
Oliver
[1] http://commons.apache.org/configuration/issue-tracking.html
>
> Example
>
> #property in property file
> test(ef)=false
>
> causes
> java.lang.NumberFormatException: For input string: "ef"
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:447)
> at java.lang.Integer.parseInt(Integer.java:497)
> at org.apache.commons.configuration.tree.DefaultConfigurationKey
> $KeyIterator.checkIndex(DefaultConfigurationKey.java:834)
> at org.apache.commons.configuration.tree.DefaultConfigurationKey
> $KeyIterator.nextKey(DefaultConfigurationKey.java:511)
> at
> org.apache.commons.configuration.tree.DefaultExpressionEngine.findNodesForKey(DefaultExpressionEngine.java:462)
> at
> org.apache.commons.configuration.tree.DefaultExpressionEngine.query(DefaultExpressionEngine.java:286)
> at
> org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
> at
> org.apache.commons.configuration.HierarchicalConfiguration.setProperty(HierarchicalConfiguration.java:735)
> at
> org.apache.commons.configuration.ConfigurationUtils.copy(ConfigurationUtils.java:143)
> at
> org.apache.commons.configuration.ConfigurationUtils.convertToHierarchical(ConfigurationUtils.java:199)
> at org.apache.commons.configuration.CombinedConfiguration
> $ConfigData.getTransformedRoot(CombinedConfiguration.java:794)
> at
> org.apache.commons.configuration.CombinedConfiguration.constructCombinedNode(CombinedConfiguration.java:653)
> at
> org.apache.commons.configuration.CombinedConfiguration.getRootNode(CombinedConfiguration.java:504)
> at
> org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:925)
> at
> org.apache.commons.configuration.HierarchicalConfiguration.getProperty(HierarchicalConfiguration.java:327)
> at
> org.apache.commons.configuration.CombinedConfiguration.getProperty(CombinedConfiguration.java:578)
> at
> org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:1155)
> at
> org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1034)
> at
> org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:1017)
>
> www.intrade.com
> The Prediction Market
>
> ABOUT US: Intrade is The Prediction Market where members can buy and sell "shares" in financial, political, weather and other important subjects. You can trade using real US$ and you can learn to trade using virtual Intrade I$.
>
> Intrade and the predictive information generated by our members have been featured on CNBC, CNN, Bloomberg, Fox, Fortune & others.
>
> Becoming a member of Intrade gives you profit opportunity and access to the wisdom of a crowd of many thousands of people from over 120 countries.
>
> Intrade News is available on RSS at http://www.intrade.com/news/newsRss.xml
>
> CONFIDENTIALITY & DISCLAIMER: The information within this email is confidential and may be privileged. It is intended solely for party to which it is addressed.
>
> Please notify us immediately if you received this mail in error by returning it to the sender and delete this copy from your system. You should also notify us at +353-1-6200 300.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org