commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Berg (JIRA)" <>
Subject [jira] Commented: (CONFIGURATION-403) XMLConfiguration isEmpty has altered behaviour between 1.4 and 1.6
Date Fri, 15 Jan 2010 08:49:54 GMT


Daniel Berg commented on CONFIGURATION-403:

I agree that the behavior described in CONFIGURATION-6 seems right for sub element but when
applied to the outermost element I am unable to tell if any configuration is provided
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
            XMLConfiguration xml = new XMLConfiguration(file);
            Iterator<String> keys = xml.getKeys();
            while (keys.hasNext()) {
                String key =;
                System.out.println("Key:" + key + ":");
                System.out.println("Value:" + xml.getString(key) + ":");
Prints the following:

Reporting there is one Key with a blank value, I feel there should be a difference on the
outermost container element and the contained elements. 

The difference between root node being defined and being empty is not maintained. The code
below demonstrates the inconsitency
            XMLConfiguration xml1 = new XMLConfiguration();
Prints true
then false

> XMLConfiguration isEmpty has altered behaviour between 1.4  and 1.6
> -------------------------------------------------------------------
>                 Key: CONFIGURATION-403
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>         Environment: Windows Vista 64, JDK 1.6
>            Reporter: Daniel Berg
>            Priority: Minor
> Given xml configuration file
> {code:xml} 
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <empty></empty>
> {code}
> {code}
> XMLConfiguration xml = new XMLConfiguration(file);
> assertTrue(xml.isEmpty());
> {code}
> isEmpty() returned true on version 1.4 ?, now it returns false, and the configuration
contains a single empty string as key.
> Not sure if this should be considered a bug, but the documnetation reads: Checks if this
configuration is empty. Empty means that there are no keys with any values, though there can
be some (empty) nodes. 

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

View raw message