You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Janusz Studzizba (JIRA)" <ji...@apache.org> on 2006/09/22 13:36:22 UTC

[jira] Created: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
-----------------------------------------------------------------------------------------

                 Key: CONFIGURATION-228
                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.2 Final
            Reporter: Janusz Studzizba


XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Configuration.xml:
<conf>
    <parent-item>
        <sub-item>old_value</sub-item>
    </parent-item>
</conf>

1. XMLConfiguration is loaded:
            config = new XMLConfiguration("c:\\conf.xml");
            config.setReloadingStrategy(new FileChangedReloadingStrategy());

2. Now, <sub-item> node value changes to "new_value",
and the code:
            Configuration parentItemConfig = config.subset("parent-item"); [AA]
            String ss2 = parentItemConfig.getString("sub-item");
returns "old_value" !!!

while:  config.getString("parent-item.sub-item"); returns new refreshed value.

It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.

[for now, workaround for config users is to call config.reload() when strategy.hasChanged()]



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Posted by "Janusz Studzizba (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-228?page=comments#action_12437755 ] 
            
Janusz Studzizba commented on CONFIGURATION-228:
------------------------------------------------

Unfortunately I don't have any jUnit test ready, but please follow the steps 1 and 2 from my initial description.
[and please note the sentence below 2. step "while: config.getString("parent-item.sub-item"); returns new refreshed value. "]

Thanks.

> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> -----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-228
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Janusz Studzizba
>
> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> Configuration.xml:
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> 1. XMLConfiguration is loaded:
>             config = new XMLConfiguration("c:\\conf.xml");
>             config.setReloadingStrategy(new FileChangedReloadingStrategy());
> 2. Now, <sub-item> node value changes to "new_value",
> and the code:
>             Configuration parentItemConfig = config.subset("parent-item"); [AA]
>             String ss2 = parentItemConfig.getString("sub-item");
> returns "old_value" !!!
> while:  config.getString("parent-item.sub-item"); returns new refreshed value.
> It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.
> [for now, workaround for config users is to call config.reload() when strategy.hasChanged()]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-228?page=all ]

Oliver Heger resolved CONFIGURATION-228.
----------------------------------------

    Fix Version/s: Nightly Builds
       Resolution: Fixed

I added some new test cases and committed a fix. Please double check.
Thanks for spotting this!

> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> -----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-228
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Janusz Studzizba
>         Assigned To: Oliver Heger
>             Fix For: Nightly Builds
>
>
> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> Configuration.xml:
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> 1. XMLConfiguration is loaded:
>             config = new XMLConfiguration("c:\\conf.xml");
>             config.setReloadingStrategy(new FileChangedReloadingStrategy());
> 2. Now, <sub-item> node value changes to "new_value",
> and the code:
>             Configuration parentItemConfig = config.subset("parent-item"); [AA]
>             String ss2 = parentItemConfig.getString("sub-item");
> returns "old_value" !!!
> while:  config.getString("parent-item.sub-item"); returns new refreshed value.
> It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.
> [for now, workaround for config users is to call config.reload() when strategy.hasChanged()]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Posted by "Janusz Studzizba (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-228?page=comments#action_12437475 ] 
            
Janusz Studzizba commented on CONFIGURATION-228:
------------------------------------------------

Olivier,

IMHO it is not a "life" subset link to parent configuration. issue.
See my code line designated with [AA]:
   Configuration parentItemConfig = config.subset("parent-item");   //[AA] 

I am creating *new* subset from parent configuration, parent config is realoded, while newly created subset from such reloaded refreshed parent returns old values..

I looked into source code, and IMHO realod() method should be called in somewhere in subset() implementation
as it is called in eg. AbstractFileConfiguration.getProperty()

> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> -----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-228
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Janusz Studzizba
>
> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> Configuration.xml:
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> 1. XMLConfiguration is loaded:
>             config = new XMLConfiguration("c:\\conf.xml");
>             config.setReloadingStrategy(new FileChangedReloadingStrategy());
> 2. Now, <sub-item> node value changes to "new_value",
> and the code:
>             Configuration parentItemConfig = config.subset("parent-item"); [AA]
>             String ss2 = parentItemConfig.getString("sub-item");
> returns "old_value" !!!
> while:  config.getString("parent-item.sub-item"); returns new refreshed value.
> It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.
> [for now, workaround for config users is to call config.reload() when strategy.hasChanged()]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-228?page=comments#action_12437659 ] 
            
Oliver Heger commented on CONFIGURATION-228:
--------------------------------------------

Sounds plausible. I will have a look.

Is there any chance that you can provide a junit test? If not, that's no problem; I think the issue should not be too difficult to reproduce.

> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> -----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-228
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Janusz Studzizba
>
> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> Configuration.xml:
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> 1. XMLConfiguration is loaded:
>             config = new XMLConfiguration("c:\\conf.xml");
>             config.setReloadingStrategy(new FileChangedReloadingStrategy());
> 2. Now, <sub-item> node value changes to "new_value",
> and the code:
>             Configuration parentItemConfig = config.subset("parent-item"); [AA]
>             String ss2 = parentItemConfig.getString("sub-item");
> returns "old_value" !!!
> while:  config.getString("parent-item.sub-item"); returns new refreshed value.
> It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.
> [for now, workaround for config users is to call config.reload() when strategy.hasChanged()]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-228) XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-228?page=comments#action_12436935 ] 
            
Oliver Heger commented on CONFIGURATION-228:
--------------------------------------------

I think the problem here is that the subset configuration returned by XMLConfiguration is not life, i.e. it is not really connected to the parent configuration. There was a bug report (CONFIGURATION-212) describing this problem.

In the current code base there is the new method configurationAt(String key) in HierarichicalConfiguration that returns a life configuration. You can try this method as an alternative.

But maybe the subset() implementation should be changed to return a life subset, too.

> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> -----------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-228
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-228
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Janusz Studzizba
>
> XMLConfiguration.subset() with FileChangedReloadingStrategy does *not* 'see' file changes
> Configuration.xml:
> <conf>
>     <parent-item>
>         <sub-item>old_value</sub-item>
>     </parent-item>
> </conf>
> 1. XMLConfiguration is loaded:
>             config = new XMLConfiguration("c:\\conf.xml");
>             config.setReloadingStrategy(new FileChangedReloadingStrategy());
> 2. Now, <sub-item> node value changes to "new_value",
> and the code:
>             Configuration parentItemConfig = config.subset("parent-item"); [AA]
>             String ss2 = parentItemConfig.getString("sub-item");
> returns "old_value" !!!
> while:  config.getString("parent-item.sub-item"); returns new refreshed value.
> It is a bug, we have FileChangedReloadingStrategy, we create new subset in [AA] but receive old values.
> [for now, workaround for config users is to call config.reload() when strategy.hasChanged()]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org