commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Gavrilov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONFIGURATION-699) HierarchicalConfiguration childConfigurationsAt(String key) method not throws exception if key is not found in XML file
Date Thu, 26 Apr 2018 14:34:00 GMT

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

Pavel Gavrilov commented on CONFIGURATION-699:
----------------------------------------------

Thank you for your answer. I've understood that's not an issue. Closing this.

> HierarchicalConfiguration childConfigurationsAt(String key) method not throws exception
if key is not found in XML file
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-699
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-699
>             Project: Commons Configuration
>          Issue Type: Bug
>            Reporter: Pavel Gavrilov
>            Priority: Major
>
> {code:java}
> List<HierarchicalConfiguration<ImmutableNode>> hierarchicalConfigurations
= configuration.childConfigurationsAt("key");
> {code}
> will return empty list if "key" is not in xml file, but
> {code:java}
> HierarchicalConfiguration<ImmutableNode> nodeHierarchicalConfiguration = configuration.configurationAt("key");
> {code}
> will throw ConfigurationRuntimeException.
> So if you don't get an exception, you may think that there is not nodes under "key" (,
but actually xml file not contains "key" (is not valid). To avoid it you have to call in
try/catch
> {code:java}
> configuration.configurationAt("key"){code}
> first, that may produce an exception and then use
> {code:java}
> configuration.childConfigurationsAt("key");{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message