You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Eduard Rindt (JIRA)" <ji...@apache.org> on 2007/09/10 11:31:29 UTC

[jira] Created: (CONFIGURATION-295) HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.

HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.
----------------------------------------------------------------------------------------------

                 Key: CONFIGURATION-295
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-295
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: Commons configuration V1.4
Loaded configuration: An ordinary commons config XML file referring to two property files.
            Reporter: Eduard Rindt


Having a HierarchicalConfiguration with entries alike:
    test.sample = subset title
    test.sample.boolean = true
    test.sample.int = 123456
    test.sample.text = I wish it worked!

When performing subset("test.sample"), I get a configuration of only three entries, the "subset title" value is not present (should have an empty string key).

The behaviour is in contradiction to Javadoc of the Configuration interface http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/Configuration.html#subset(java.lang.String)

Seems to me, that the bug is hidden in iterating the cloned configuration, where only children of the clone are processed, but not the root itself.

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


[jira] Resolved: (CONFIGURATION-295) HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.

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

Oliver Heger resolved CONFIGURATION-295.
----------------------------------------

    Resolution: Fixed

A fix was committed. The value of the root node of the returned configuration will now be set if possible.

There is one problem however: If the key that is passed to the subset() method selects multiple nodes and more than one of these nodes has a value, the value of the root node cannot be determined. This is because in this case multiple source nodes have to be mapped to a single destination (the root) node. With child and attribute nodes this is no problem because we can simple construct the union. But for node values (which can be arbitrary objects) we cannot decide how to merge this data.

I have mentioned this point in the Javadocs of the subset() method. Simple cases, as the one in your example, should now work as expected.

Thank you for spotting this problem!

> HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.
> ----------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-295
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-295
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Commons configuration V1.4
> Loaded configuration: An ordinary commons config XML file referring to two property files.
>            Reporter: Eduard Rindt
>            Assignee: Oliver Heger
>             Fix For: 1.5
>
>
> Having a HierarchicalConfiguration with entries alike:
>     test.sample = subset title
>     test.sample.boolean = true
>     test.sample.int = 123456
>     test.sample.text = I wish it worked!
> When performing subset("test.sample"), I get a configuration of only three entries, the "subset title" value is not present (should have an empty string key).
> The behaviour is in contradiction to Javadoc of the Configuration interface http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/Configuration.html#subset(java.lang.String)
> Seems to me, that the bug is hidden in iterating the cloned configuration, where only children of the clone are processed, but not the root itself.

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


[jira] Updated: (CONFIGURATION-295) HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.

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

Oliver Heger updated CONFIGURATION-295:
---------------------------------------

    Fix Version/s: 1.5

Setting fix version to 1.5. This should not be too difficult to fix.

> HierarchicalConfiguration.subset(...) misses an entry with the key equal to the subset prefix.
> ----------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-295
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-295
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Commons configuration V1.4
> Loaded configuration: An ordinary commons config XML file referring to two property files.
>            Reporter: Eduard Rindt
>             Fix For: 1.5
>
>
> Having a HierarchicalConfiguration with entries alike:
>     test.sample = subset title
>     test.sample.boolean = true
>     test.sample.int = 123456
>     test.sample.text = I wish it worked!
> When performing subset("test.sample"), I get a configuration of only three entries, the "subset title" value is not present (should have an empty string key).
> The behaviour is in contradiction to Javadoc of the Configuration interface http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/Configuration.html#subset(java.lang.String)
> Seems to me, that the bug is hidden in iterating the cloned configuration, where only children of the clone are processed, but not the root itself.

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