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

Gary D. Gregory edited comment on CONFIGURATION-848 at 6/30/24 11:42 AM:
-------------------------------------------------------------------------

[~laszlohujber] 

The test you posted in this ticket's description passes for me on 2.9.0 (tag 
{{{}rel/commons-configuration-2.9.0{}}}):
{code:java}
    @Test
    public void testSubsetWithJSONConfiguration() throws FileNotFoundException, 
ConfigurationException {
        final JSONConfiguration jsonConfiguration = new JSONConfiguration();
        jsonConfiguration.read(new 
FileReader(ConfigurationAssert.getTestFile("test.json").getAbsolutePath()));

        final SubsetConfiguration subset = new 
SubsetConfiguration(jsonConfiguration, "capitals(0)", ".");

        assertFalse(subset.isEmpty());
        assertEquals(2, subset.size());
        assertEquals("USA", subset.getString("country"));
    }
{code}
For the PR, what version does the test pass for you?

 


was (Author: garydgregory):
[~laszlohujber] 

The test you posted in this ticket's description passes for me on 2.9.0 (tag 
{{{}rel/commons-configuration-2.9.0{}}}):
{code:java}
    @Test
    public void testSubsetWithJSONConfiguration() throws FileNotFoundException, 
ConfigurationException {
        final JSONConfiguration jsonConfiguration = new JSONConfiguration();
        jsonConfiguration.read(new 
FileReader(ConfigurationAssert.getTestFile("test.json").getAbsolutePath()));

        final SubsetConfiguration subset = new 
SubsetConfiguration(jsonConfiguration, "capitals(0)", ".");

        assertFalse(subset.isEmpty());
        assertEquals(2, subset.size());
        assertEquals("USA", subset.getString("country"));
    }
{code}
For the PR, for version does the test pass?

 

> SubsetConfiguration with subclasses of AbstractHierarchicalConfiguration
> ------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-848
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-848
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.10.0, 2.10.1, 2.11.0
>            Reporter: Laszlo Hujber
>            Assignee: Gary D. Gregory
>            Priority: Major
>
> A bug occurs when using {{SubsetConfiguration}} with concrete subclasses of 
> {{{}AbstractHierarchicalConfiguration{}}}. This issue likely happens because 
> {{AbstractHierarchicalConfiguration}} does not override:
> {code:java}
> protected Iterator<String> getKeysInternal(String prefix, String delimiter) {
> }
> {code}
> The relevant pull request that introduced this bug is 
> [#300|https://github.com/apache/commons-configuration/pull/300].
> Refer to the test case that passes in version 2.9.
> {code:java}
>     @Test
>     public void testSubsetWithJSONConfiguration() throws 
> FileNotFoundException, ConfigurationException {
>         final JSONConfiguration jsonConfiguration = new JSONConfiguration();
>         jsonConfiguration.read(new 
> FileReader(ConfigurationAssert.getTestFile("test.json").getAbsolutePath()));
>         final SubsetConfiguration subset = new 
> SubsetConfiguration(jsonConfiguration, "capitals(0)", ".");
>         assertFalse(subset.isEmpty());
>         assertEquals(2, subset.size());
>         assertEquals("USA", subset.getString("country"));
>     }
> {code}
> Actual Behavior:
>  * {{isEmpty()}} returns {{{}true{}}}.
>  * {{size()}} returns {{{}0{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to