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

Oliver Heger commented on CONFIGURATION-265:
--------------------------------------------

This is indeed a bug, updates in the subnode configuration do not trigger the 
parent's auto-save mechanism.

To be consequent, these updates should then also generate change events for the 
parent configuration. However this will be problematic because we cannot simply 
transform the configuration key used by the subnode configuration into the 
namespace of the parent (the expression engines do not provide this 
functionality at the moment).  So the only chance I see is to introduce a new 
event type EVENT_SUBNODE_CHANGED. The properties of this event type can contain 
all available information about the change.

In the next major release we can extend the interface for the expression 
engines to work around this limitation.

> XMLConfiguration with setAutoSave(true) doesn't save if SubnodeConfiguration 
> is changed
> ---------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-265
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-265
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Irina Fridkina
>             Fix For: 1.5
>
>
> config.xml file
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> The problem can be reproduced as follows: 
>  1 XMLConfiguration config = new XMLConfiguration("c:\\conf.xml"); 
>  2 config.setAutoSave(true) ;
>  3 SubnodeConfiguration parentItemConfig = 
> config.configurationAt("parent-item"); 
>  4 parentItemConfig.setProperty("sub-item","new_value");
>  5. System.out.println(config.getString("parent-item.sub-item");  // will 
> print new_value
>  // if you look at the config.xml sub-item still has old_value
>  // also if you try to do 
>  5 XMLConfiguration config2 = new XMLConfiguration("c:\\conf.xml");
>  6. System.out.println(config2.getString("parent-item.sub-item");  // will 
> print old_value

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to