[ 
https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661862#action_12661862
 ] 

Oliver Heger commented on CONFIGURATION-358:
--------------------------------------------

I think, what you observe here is standard behavior of hierarchical 
configurations:
* The dot character in {{property.1}} has a special meaning as property 
delimiter for the expression engine used per default by 
{{HierarchicalINIConfiguration}}, so it is automatically escaped by duplicating 
it. This is explained in the [User 
Guide|http://commons.apache.org/configuration/userguide/howto_xml.html#Escaping_dot_characters_in_XML_tags].
 If you do not want to use escaping, you can set an {{ExpressionEngine}} that 
is configured to use a different property delimiter. An example of how to do 
this can be found 
[here|http://commons.apache.org/configuration/userguide/howto_xml.html#The_default_expression_engine].
* The {{subset()}} method does not what you want when you need to access the 
global section. Invoking {{subset(null)}} returns a configuration that contains 
all properties below the key *null*, which denotes the root node - i.e. all 
properties of the original configuration. Use the {{getSection()}} method 
instead. {{getSection(null)}} should return only the properties of the global 
section and no more.

These are subtle differences between {{INIConfiguration}} and 
{{HierarchicalINIConfiguration}} caused by the fact that the latter is derived 
from {{HierarchicalConfiguration}}. But I don't think these are bugs. Maybe 
some hints in the documentation could be added?

> subset returned from HierarchicalINIConfiguration has unexpected property 
> names
> -------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-358
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-358
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Documentation, Format
>    Affects Versions: 1.6
>            Reporter: Charles Honton
>             Fix For: 1.6
>
>         Attachments: TestHierarchicalINIConfiguration.java
>
>
> With the following ini file
> # comment
> property.1 = g1
> property.2 : g2
> [section]
> property.1 = l1
> HierarchicalINIConfiguration properly creates two sections: null and 
> "section".  However, the subsets from this configuration do not have the 
> expected property names.
> The global subset contains the following name=value pairs:
> property..1=g1
> property..2=g2
> section.property..1=l1
> The "section" subset contains the following name=value pairs:
> property..1=g1
> I expected the global subset to contain:
> property.1=g1
> property.2=g2
> I expected the "section" subset to contain:
> property.1 = l1

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

Reply via email to