You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Daniel Berg (JIRA)" <ji...@apache.org> on 2010/01/14 13:36:54 UTC
[jira] Created: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
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
Fix For: 1.7
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Heger resolved CONFIGURATION-403.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.7
Should be fixed in subversion now (revision 902439).
I applied a slightly different solution: IMO the problem was caused by the load() method which used to assign the root node an empty text even if the XML root element had no content. So I added a condition here rather than in the isEmpty() method.
Nevertheless thank you very much for the patch and your analyis.
> 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
> Assignee: Oliver Heger
> Priority: Minor
> Fix For: 1.7
>
> Attachments: configuration-403.patch
>
>
> 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.
[jira] Updated: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Daniel Berg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Berg updated CONFIGURATION-403:
--------------------------------------
Fix Version/s: (was: 1.7)
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800589#action_12800589 ]
Oliver Heger commented on CONFIGURATION-403:
--------------------------------------------
AFAICT this behavior was already changed in an earlier version of Commons Configuration in reaction to the ticket CONFIGURATION-6.
IMO the new behavior is more consistent because it allows to distinguish between a configuration with no keys at all and a configuration that contains some empty keys. But maybe we should update the documentation to make clear what is meant by "empty".
> 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.
[jira] Updated: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Daniel Berg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Berg updated CONFIGURATION-403:
--------------------------------------
Description:
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.
was:
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.
> 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.
[jira] Updated: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Daniel Berg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CONFIGURATION-403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Berg updated CONFIGURATION-403:
--------------------------------------
Attachment: configuration-403.patch
patch alters HierarchicalConfiguration isEmpty to test for existense of attributes or children and add a testcase for xmlconfiguration, does not violate any other tests.
> 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
> Attachments: configuration-403.patch
>
>
> 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.
[jira] Commented: (CONFIGURATION-403) XMLConfiguration isEmpty has
altered behaviour between 1.4 and 1.6
Posted by "Daniel Berg (JIRA)" <ji...@apache.org>.
[ 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.