commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CONFIGURATION-293) HierarchicalConfiguration.clearTree() does not remove named property
Date Thu, 23 Aug 2007 08:20:30 GMT

    [ https://issues.apache.org/jira/browse/CONFIGURATION-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522059
] 

Oliver Heger commented on CONFIGURATION-293:
--------------------------------------------

Ah, I think I know now what is going on.

With a CombinedConfiguration things are a little bit different. The node structure of a combined
configuration is constructed from the nodes of its contained child configurations each time
one of the children is modified. In your test you remove a sub tree, which causes a child
configuration to be changed and results in an update event. This event causes the combined
configuration to be re-created. This time, because an override node combiner is used (the
child configurations are defined in an <override> section), the just deleted sub tree
is pulled in from another child configuration.

The following section of the user guide contains more information about updates on combined
configurations; it should give you some background information about what is happening:
http://commons.apache.org/configuration/userguide/howto_combinedconfiguration.html#Dealing_with_changes

Well, how should this issue be treated? What you have found here is a known limitation of
CombinedConfiguration. Given its design, it is not trivial to change. So I tend to resolve
this issue as Won't fix. What do you think?

> HierarchicalConfiguration.clearTree() does not remove named property
> --------------------------------------------------------------------
>
>                 Key: CONFIGURATION-293
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-293
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Wesley Miaw
>         Attachments: bug-config.xml, bug-override.xml, bug-test.properties
>
>
> HierarchicalConfiguration.clearTree(String) calls HierarchicalConfiguration.removeNode(ConfigurationNode)
which removes nothing if the passed in ConfigurationNode has no parent. Having no parent is
true of nodes that have the root for their parent (it seems to me) as well as for nodes that
have no properties defined "above" them. Here is an example:
> config.addProperty("a.b.c", "c");
> config.addProperty("a.b.c.d", "d");
> config.addProperty("a.b.c.d.e", "e");
> The following sequence of calls will fail:
> config.clearTree("a.b.c");
> assert config.containsKey("a.b.c") == false;
> The following sequence of calls will succeed:
> config.clearTree("a.b.c.d");
> assert config.containsKey("a.b.c.d") == false;
> assert config.containsKey("a.b.c.d.e") == false;

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


Mime
View raw message