[jira] Created: (CONFIGURATION-294) Trying to set values in the newly added node (using XMLConfiguration) doesn't work

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CONFIGURATION-294) Trying to set values in the newly added node (using XMLConfiguration) doesn't work

Furkan KILIC (Jira)
Trying to set values in the newly added node (using XMLConfiguration) doesn't work
----------------------------------------------------------------------------------

                 Key: CONFIGURATION-294
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-294
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.4, 1.5
            Reporter: vivek


I'm using XMLConfiguration to manipulate my xml configuration file. Here is what I did,

1) Add a new node using "addNodes"
2) Save the configuration (using save method)
3) The new node gets added to the configuration file   <--- Good
4) Now try setting a value in the just added new node using "setProperty" method.
5) Save the configuration (using save method)
6) The save method still writes the configuration that was in step 3        <------- Bug

Looks like for some reason the save still holds the old configuration in cache that after the add nodes. If I call "reload" after each save then everything works fine.

Just a setProperty on its own (without addNodes) work fine. It's only when you try to addNodes and then do setProperty that this fails.

I've tried this with the latest nightly build (1.5), released 1.4 and 1.3 --> all of them fail in this situation.




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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (CONFIGURATION-294) Trying to set values in the newly added node (using XMLConfiguration) doesn't work

Furkan KILIC (Jira)

     [ https://issues.apache.org/jira/browse/CONFIGURATION-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger updated CONFIGURATION-294:
---------------------------------------

    Fix Version/s: 1.5
         Assignee: Oliver Heger

You are right, this is a bug.

The problem seems to be that the nodes passed to addNodes() are directly added to the internal node structure without checking for their type: If they are HierarchicalConfiguration.Node objects and not XMLConfiguration.XMLNode objects, a change of their value is not reflected in the internally hold XML document.

A solution is to convert the nodes in addNodes() to the correct type XMLNode if necessary.

> Trying to set values in the newly added node (using XMLConfiguration) doesn't work
> ----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-294
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-294
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4, 1.5
>            Reporter: vivek
>            Assignee: Oliver Heger
>             Fix For: 1.5
>
>
> I'm using XMLConfiguration to manipulate my xml configuration file. Here is what I did,
> 1) Add a new node using "addNodes"
> 2) Save the configuration (using save method)
> 3) The new node gets added to the configuration file   <--- Good
> 4) Now try setting a value in the just added new node using "setProperty" method.
> 5) Save the configuration (using save method)
> 6) The save method still writes the configuration that was in step 3        <------- Bug
> Looks like for some reason the save still holds the old configuration in cache that after the add nodes. If I call "reload" after each save then everything works fine.
> Just a setProperty on its own (without addNodes) work fine. It's only when you try to addNodes and then do setProperty that this fails.
> I've tried this with the latest nightly build (1.5), released 1.4 and 1.3 --> all of them fail in this situation.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CONFIGURATION-294) Trying to set values in the newly added node (using XMLConfiguration) doesn't work

Furkan KILIC (Jira)
In reply to this post by Furkan KILIC (Jira)

     [ https://issues.apache.org/jira/browse/CONFIGURATION-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-294.
----------------------------------------

    Resolution: Fixed

A fix was applied. Thank you for spotting this.

> Trying to set values in the newly added node (using XMLConfiguration) doesn't work
> ----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-294
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-294
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4, 1.5
>            Reporter: vivek
>            Assignee: Oliver Heger
>             Fix For: 1.5
>
>
> I'm using XMLConfiguration to manipulate my xml configuration file. Here is what I did,
> 1) Add a new node using "addNodes"
> 2) Save the configuration (using save method)
> 3) The new node gets added to the configuration file   <--- Good
> 4) Now try setting a value in the just added new node using "setProperty" method.
> 5) Save the configuration (using save method)
> 6) The save method still writes the configuration that was in step 3        <------- Bug
> Looks like for some reason the save still holds the old configuration in cache that after the add nodes. If I call "reload" after each save then everything works fine.
> Just a setProperty on its own (without addNodes) work fine. It's only when you try to addNodes and then do setProperty that this fails.
> I've tried this with the latest nightly build (1.5), released 1.4 and 1.3 --> all of them fail in this situation.

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