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 2012/09/06 22:16:07 UTC

[jira] [Commented] (CONFIGURATION-504) HierarchicalConfiguration clear() method doesn't remove the node from its parent anymore in XML source

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

Oliver Heger commented on CONFIGURATION-504:
--------------------------------------------

Hm, I am not sure which change in 1.8 could be responsible that the {{clear()}} method now behaves differently.

It would be possible to change {{SubnodeConfiguration}} so that its {{clear()}} method clears the parent node in the parent configuration. Then the subnode configuration is actually detached. I just wonder what should happen if you later add new properties to the subnode configuration. They would then no longer be added to the parent configuration.

Do you know what the behavior was in this case in version 1.7?
                
> HierarchicalConfiguration clear() method doesn't remove the node from its parent anymore in XML source
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-504
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-504
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.8
>            Reporter: Adrien CLERC
>            Priority: Minor
>
> Using an XML source file, I used to call HierarchicalConfiguration.clear() on an object to remove it from its parent. Now, it just clear the text and the subnodes, but not the node itself, nor its own attribute, when the file is saved.
> Here is the code that works :
> {code}
> ConfigurationNode oldNode = configuration.getRootNode();
> oldNode.getParentNode().removeChild(oldNode);
> {code}
> configuration belong to a list of HierarchicalConfiguration that I obtained from configurationsAt. I didn't see any other way to remove a node I got from that method, without explicit casting to SubnodeConfiguration.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira