commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Berg (JIRA)" <j...@apache.org>
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

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

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
{code:xml}
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<empty/>
{code}
{code}
            XMLConfiguration xml = new XMLConfiguration(file);
            System.out.println(xml.isEmpty());
            System.out.println(xml.getRootNode().getName());
            Iterator<String> keys = xml.getKeys();
            while (keys.hasNext()) {
                String key = keys.next();
                System.out.println("Key:" + key + ":");
                System.out.println("Value:" + xml.getString(key) + ":");
            }
{code}
Prints the following:
false
empty
Key::
Value::

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
{code}
            XMLConfiguration xml1 = new XMLConfiguration();
            System.out.println(xml1.isEmpty());
            xml1.save("text.xml");
            xml1.load("text.xml");
            System.out.println(xml1.isEmpty());            
{code}
Prints true
then false






> XMLConfiguration isEmpty has altered behaviour between 1.4  and 1.6
> -------------------------------------------------------------------
>
>                 Key: CONFIGURATION-403
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-403
>             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.


Mime
View raw message