You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Meyer (JIRA)" <ji...@apache.org> on 2009/03/07 09:42:56 UTC

[jira] Created: (CONFIGURATION-368) CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration

CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration
----------------------------------------------------------------------------------------------------------------------

                 Key: CONFIGURATION-368
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-368
             Project: Commons Configuration
          Issue Type: Bug
          Components: File reloading
    Affects Versions: 1.6
            Reporter: Paul Meyer


Steps to repeat:
- create a XMLConfiguration based on a XML config file (xml file content e.g.:  <config><foo><bar>0</bar></for></config>)
- assign file reloading strategy to the XMLConfiguration
- create a SubnodeConfiguration based on this XMLConfiguration (prefix e.g.: 'foor')
- create a CombinedConfiguration
- add the SubnodeConfiguration to this CombinedConfiguration
- get a configuration value from the CombinedConfiguration (e.g. 'bar') -> OK, this works
- touch the underlying xml configuration
- try to get a configuration value from the CombinedConfiguration again (e.g. 'bar') ->  java.util.NoSuchElementException

See also attached TestCase.

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


[jira] Commented: (CONFIGURATION-368) CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680002#action_12680002 ] 

Oliver Heger commented on CONFIGURATION-368:
--------------------------------------------

The problem is the following: Though the SubnodeConfiguration detects that its parent configuration was changed and it updates itself, it does not fire any change event. Thus the hosting CombinedConfiguration does not recognize that there are any changes; querying the CombinedConfiguration returns stale data.

A fix is to sent a change event whenever the SubnodeConfiguration detects a change of its parent.

To get the test case pass I also had to slightly modify the node construction process of CombinedConfiguration: In the tests {{FileAlwaysReloadingStrategy}} is used as reloading strategy, which triggers a reload on every property access. Obviously it is problematic if multiple reloads occur while the node structure of a single child configuration of the CombinedConfiguration is constructed. The new code makes sure that {{getRootNode()}} on the child configuration is called only once.

> CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-368
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-368
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 1.6
>            Reporter: Paul Meyer
>            Assignee: Oliver Heger
>         Attachments: TestCombinedConfigurationReload.java
>
>
> Steps to repeat:
> - create a XMLConfiguration based on a XML config file (xml file content e.g.:  <config><foo><bar>0</bar></for></config>)
> - assign file reloading strategy to the XMLConfiguration
> - create a SubnodeConfiguration based on this XMLConfiguration (prefix e.g.: 'foor')
> - create a CombinedConfiguration
> - add the SubnodeConfiguration to this CombinedConfiguration
> - get a configuration value from the CombinedConfiguration (e.g. 'bar') -> OK, this works
> - touch the underlying xml configuration
> - try to get a configuration value from the CombinedConfiguration again (e.g. 'bar') ->  java.util.NoSuchElementException
> See also attached TestCase.

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


[jira] Updated: (CONFIGURATION-368) CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration

Posted by "Paul Meyer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Meyer updated CONFIGURATION-368:
-------------------------------------

    Attachment: TestCombinedConfigurationReload.java

TestCase illustrating the issue.

> CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-368
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-368
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 1.6
>            Reporter: Paul Meyer
>         Attachments: TestCombinedConfigurationReload.java
>
>
> Steps to repeat:
> - create a XMLConfiguration based on a XML config file (xml file content e.g.:  <config><foo><bar>0</bar></for></config>)
> - assign file reloading strategy to the XMLConfiguration
> - create a SubnodeConfiguration based on this XMLConfiguration (prefix e.g.: 'foor')
> - create a CombinedConfiguration
> - add the SubnodeConfiguration to this CombinedConfiguration
> - get a configuration value from the CombinedConfiguration (e.g. 'bar') -> OK, this works
> - touch the underlying xml configuration
> - try to get a configuration value from the CombinedConfiguration again (e.g. 'bar') ->  java.util.NoSuchElementException
> See also attached TestCase.

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


[jira] Resolved: (CONFIGURATION-368) CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-368.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.7

Should be fixed now in subversion (r751500). The fix was also ported to the configuration2 branch.

> CombinedConfiguration: java.util.NoSuchElementException after reload of enclosed SubnodeConfiguration/XMLConfiguration
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-368
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-368
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 1.6
>            Reporter: Paul Meyer
>            Assignee: Oliver Heger
>             Fix For: 1.7
>
>         Attachments: TestCombinedConfigurationReload.java
>
>
> Steps to repeat:
> - create a XMLConfiguration based on a XML config file (xml file content e.g.:  <config><foo><bar>0</bar></for></config>)
> - assign file reloading strategy to the XMLConfiguration
> - create a SubnodeConfiguration based on this XMLConfiguration (prefix e.g.: 'foor')
> - create a CombinedConfiguration
> - add the SubnodeConfiguration to this CombinedConfiguration
> - get a configuration value from the CombinedConfiguration (e.g. 'bar') -> OK, this works
> - touch the underlying xml configuration
> - try to get a configuration value from the CombinedConfiguration again (e.g. 'bar') ->  java.util.NoSuchElementException
> See also attached TestCase.

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