[jira] Commented: (CONFIGURATION-404) Revisit - Brackets in property key causes NumberFormatException

2010-01-27 Thread Rob Walker (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12805488#action_12805488
 ] 

Rob Walker commented on CONFIGURATION-404:
--

Great, thanks Oliver. I can move us back the official SVN rev here and remove 
our local patch. Good news.

 Revisit - Brackets in property key causes NumberFormatException
 ---

 Key: CONFIGURATION-404
 URL: https://issues.apache.org/jira/browse/CONFIGURATION-404
 Project: Commons Configuration
  Issue Type: Bug
Affects Versions: 1.5
Reporter: Rob Walker
Assignee: Oliver Heger
 Fix For: 1.7

 Attachments: DefaultConfigurationKey.java-NFE.patch, 
 DefaultConfigurationKey.java.patch


 Hi,
 When using brackets in property key we get an exception every time.
 Escaping brackets with \ doesn't 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)
  
 Explanation i got in mailing list from Oliver Heger
 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (CONFIGURATION-404) Revisit - Brackets in property key causes NumberFormatException

2010-01-24 Thread Rob Walker (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12804406#action_12804406
 ] 

Rob Walker commented on CONFIGURATION-404:
--

Oliver - hope the new patch is usable. I'm not so familiar with the unit test 
architecture, but it should be pretty simple  - just include property with 
brackets in and make sure it doesn't throw a NumberFormatException. The 
specific Windows Vista/7 ones that trip this now are system properties like 
C:\Program Files(x86)

 Revisit - Brackets in property key causes NumberFormatException
 ---

 Key: CONFIGURATION-404
 URL: https://issues.apache.org/jira/browse/CONFIGURATION-404
 Project: Commons Configuration
  Issue Type: Bug
Affects Versions: 1.5
Reporter: Rob Walker
Assignee: Oliver Heger
 Fix For: 1.6

 Attachments: DefaultConfigurationKey.java-NFE.patch, 
 DefaultConfigurationKey.java.patch


 Hi,
 When using brackets in property key we get an exception every time.
 Escaping brackets with \ doesn't 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)
  
 Explanation i got in mailing list from Oliver Heger
 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (CONFIGURATION-404) Revisit - Brackets in property key causes NumberFormatException

2010-01-14 Thread Rob Walker (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12800546#action_12800546
 ] 

Rob Walker commented on CONFIGURATION-404:
--

The bug reported above was raised under JIRA-336, and closed as having ways to 
workaround - which is correct.

On Vista and Win7 this  issue now crops up a lot because of the usage of 
ProgramFiles(x86) as a standard directory name.

The workaround proposal under the original issue requires every user to 
implement their own workaround, and it's non trivial because many of the member 
fields and methods of tree classes are private and so a simple subclass based 
solution can't be used.

An alternative approach is to simple catch the exception  and handle it, 
reporting the item as not an index.. TBH I'd say an unhandled of this nature 
is less than ideal in library code anyway, so my view is that this also 
strengthens the codebase.

We have locally implemented this patch and it's working very well, so would 
like to see it in the codebase.



 Revisit - Brackets in property key causes NumberFormatException
 ---

 Key: CONFIGURATION-404
 URL: https://issues.apache.org/jira/browse/CONFIGURATION-404
 Project: Commons Configuration
  Issue Type: Bug
Affects Versions: 1.5
Reporter: Rob Walker
Assignee: Oliver Heger
 Fix For: 1.6


 Hi,
 When using brackets in property key we get an exception every time.
 Escaping brackets with \ doesn't 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)
  
 Explanation i got in mailing list from Oliver Heger
 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.