DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32799>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32799

           Summary: [configuration] HierarchicalXMLConfiguration: Phantom-
                    Keys with [EMAIL PROTECTED]:base] when using nested 
XML-Files
           Product: Commons
           Version: Nightly Builds
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Configuration
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Hello,

I just tried the build from the newest nightly source code an get a strange
behaviour for HierarchicalXMLConfiguration in
http://cvs.apache.org/builds/jakarta-commons/nightly/commons-configuration/commons-configuration-src-20041222.zip
if I use nested XML-Configuration-Files.

I tried the following:
- I have a XML-Configuration file super.xml. Within this file, I define an
!ENTITY pointing to another XML-File sub.xml.
- This entity is used within the original XML-File super.xml to include the
other XML-File sub.xml.
- I load the configuration from the original XML-File super.xml.

When I now print all keys contained in the HierarchicalXMLConfiguration, I get
for every element from sub.xml an extra configuration entry with the element
followed by [EMAIL PROTECTED]:base] as the key and the complete URL to sub.xml 
as the value.

As an example, consider the following code:

        try {
            FileConfiguration myHierarchicalXMLConfig = new
HierarchicalXMLConfiguration();
            FileConfiguration myXMLConfig = new XMLConfiguration();
            Iterator iter;
            String currentKey;
            myHierarchicalXMLConfig.load("super.xml");
            iter = myHierarchicalXMLConfig.getKeys("INT");
            while (iter.hasNext()) {
                currentKey = (String) iter.next();
                System.out.println("HierarchicalXMLConfiguration: "
                        + currentKey + " "
                        + myHierarchicalXMLConfig.getProperty(currentKey));
            }
            myXMLConfig.load("vFConfig.xml");
            iter = myXMLConfig.getKeys("INT");
            while (iter.hasNext()) {
                currentKey = (String) iter.next();
                System.out.println("XMLConfiguration: " + currentKey + " "
                        + myXMLConfig.getProperty(currentKey));
            }
        } catch (ConfigurationException e) {
            System.out.println("ERROR: " + e.toString());
        }

Its output looks like this:

HierarchicalXMLConfiguration: INT.SECOND.INT 2
HierarchicalXMLConfiguration: [EMAIL PROTECTED]:base] 
file:///E:/eclipse/workspace/sub.xml
HierarchicalXMLConfiguration: INT.FIRST.INT 1
XMLConfiguration: INT.FIRST.INT 1
XMLConfiguration: INT.SECOND.INT 2

What I expected is that the key [EMAIL PROTECTED]:base] should never appear in 
this
output as it does for XML-Configuration.

Using the offical 1.0 release of commons-configuration, I get the correct 
output:

HierarchicalXMLConfiguration: INT.FIRST.INT 1
HierarchicalXMLConfiguration: INT.SECOND.INT 2
XMLConfiguration: INT.FIRST.INT 1
XMLConfiguration: INT.SECOND.INT 2

This output is expected to accour also when using the current nightly source 
code.

The important part of my included xml-configuratzion-file ("sub.xml") looks like
tbis:

<INT>
<FIRST>
<INT>1
</INT>
</FIRST>
<SECOND>
<INT>2
</INT>
</SECOND>
</INT>

It would be nice, if this could be fixed again.

Thanks a lot.

Best regards,

Christian Kemmer

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to