You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2009/11/08 22:31:32 UTC

[jira] Commented: (CONFIGURATION-401) HierarchicalConfiguration does not support hierarchy from property files

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

Oliver Heger commented on CONFIGURATION-401:
--------------------------------------------

By converting the flat configuration to a hierarchical one a tree is constructed, but in this case it has a different structure than you expect. It looks like the following:

{noformat}
persons
    person
        name=1
        name=4
        name=7
        surName=2
        ...
{noformat}

The problem is that a flat configuration format like a properties file simply does not contain enough information about the internal structure of its properties. So the algorithm that creates a hierarchical configuration from this data has no information how it should combine certain properties (e.g. add multiple _person_ elements instead of adding all data to a single _person_ element).

I don't think there is much we can do about this. An algorithm smart enough to deal with this problem would really be complex - if it is feasable at all.

> HierarchicalConfiguration does not support hierarchy  from property files
> -------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-401
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-401
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: windows/Linux
>            Reporter: yair ogen
>
> If you have hierarchy like this:
> persons.person.name=1
> persons.person.surName=2
> persons.person.phoneNum=3
> persons.person.name=4
> persons.person.surName=5
> persons.person.phoneNum=6
> persons.person.name=7
> persons.person.surName=8
> persons.person.phoneNum=9
> If I have a regular property configuration that loaded a file containing in the above. then I transform into HierarchicalConfiguration  using: ConfigurationUtils.convertToHierarchical(configuration).
> The tree is not right.
> I can do this:
> hierarchicalConfiguration.subset("persons").subset("person(0)").getKeys()
> but this returned empty iterator:
> hierarchicalConfiguration.subset("persons").subset("person(1)").getKeys()
> Only the first person is available.

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