You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Charles Honton (JIRA)" <ji...@apache.org> on 2009/01/07 20:34:44 UTC

[jira] Created: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

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


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.


[jira] Updated: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Charles Honton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Honton updated CONFIGURATION-358:
-----------------------------------------

    Attachment: TestHierarchicalINIConfiguration.java

Updated test to use getSection() instead of subset()

> 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, 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.


[jira] Updated: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Charles Honton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Honton updated CONFIGURATION-358:
-----------------------------------------

    Attachment: TestHierarchicalINIConfiguration.java

Working test with property delimiter set.

> 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, TestHierarchicalINIConfiguration.java, 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.


[jira] Resolved: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-358.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.6)
                   1.7

Some head lines in the user's guide were changed and the wording was altered to make it more explicit that features described for {{XMLConfiguration}} apply to other hierarchical configuration implementations as well.

> 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
>            Assignee: Oliver Heger
>             Fix For: 1.7
>
>         Attachments: TestHierarchicalINIConfiguration.java, TestHierarchicalINIConfiguration.java, 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.


[jira] Updated: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Charles Honton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Honton updated CONFIGURATION-358:
-----------------------------------------

    Attachment: TestHierarchicalINIConfiguration.java

JUnit test

> 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.


[jira] Commented: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662257#action_12662257 ] 

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

You are right that the dot is used as property delimiter for historic reasons. When XML configurations were introduced it was decided to use the dot as delimiter between XML element names to resemble the way properties files are typically constructed. Now it became a standard for hierarchical configurations, and we probably have to stick with it.

I don't know whether it makes sense to disable parsing of the property delimiter in an ExpressionEngine. This is a central part of what an expression engine does. And it restricts using of a hierarchical configuration dramatically. For instance, using a hierarchical INI configuration you still want to access single properties with a key like {{section.property}}. You could not do that if property delimiters are not recognized. So changing the property delimiter to a character that is not contained in the keys makes sense to me, but not disabling it at all.

I agree that the documentation about the escaping syntax is hidden in the XML section. If we restructure it to apply to all hierarchical configurations, can we then close this ticket?

> 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, TestHierarchicalINIConfiguration.java, 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.


[jira] Commented: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Charles Honton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661999#action_12661999 ] 

Charles Honton commented on CONFIGURATION-358:
----------------------------------------------

The dot escaping documentation is buried in a section about XML tags - not INI files.  As you said, more hints required.

A bigger question to me is why the dot escaping is required at all.  It appears to be an implementation relic of property file parsing.  I finally got the results I wanted with 

			DefaultExpressionEngine expressionEngine = new DefaultExpressionEngine();
			expressionEngine.setPropertyDelimiter("\000");

			HierarchicalINIConfiguration rc= new HierarchicalINIConfiguration();
			rc.setExpressionEngine(expressionEngine);

An aside, how about a method on the ExpressionEngine to turn off property delimiting?

> 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, TestHierarchicalINIConfiguration.java, 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.


[jira] Commented: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (CONFIGURATION-358) subset returned from HierarchicalINIConfiguration has unexpected property names

Posted by "Charles Honton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662368#action_12662368 ] 

Charles Honton commented on CONFIGURATION-358:
----------------------------------------------

yes, thanks.

> 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, TestHierarchicalINIConfiguration.java, 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.