XML configuration handles non-default list delimiter bad way
------------------------------------------------------------

                 Key: CONFIGURATION-354
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-354
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.5
         Environment: Windows XP Home edition, Java 1.6.0_07
            Reporter: Peter Verhas
            Priority: Minor


When setting the list separator character the XML configuration engine does not 
handle the lists properly. Sample code:

Junit test code:
{code}
    public void testConfig() {
        CompositeConfiguration conf = null;
        try {
            conf = (CompositeConfiguration) new 
ConfigurationFactory("config.xml").getConfiguration();
        } catch (ConfigurationException ex) {
            Logger.getLogger(TestConfig.class.getName()).log(Level.SEVERE, 
null, ex);
            return;
        }
        PrintStream o = System.out;
        conf.setListDelimiter(conf.getString("list.delimiter").charAt(0));
        o.println("c=" + conf.getString("c"));
        o.println("x="+conf.getString("key.subkey(1)"));
        o.print(System.getProperty("java.version"));
    }
{code}

The config.xml contains
{code}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <xml fileName="application.xml"/>
</configuration>
{code}

and finally the application.xml is
{code}
<?xml version="1.0" encoding="windows-1250"?>
<konfig>
    <list><delimiter>\,</delimiter></list>
    <key>
        <subkey>one,two,three</subkey>
        <subkey >four</subkey>
    </key>
    <c>${key.subkey(1)}</c>
</konfig>
{code}

The resulting output is:
{code}
c=two
x=two
1.6.0_07
{code}

This is correct so far. This is the case when I comment out the 
{{setListDelimiter}} code line. After this I change the application.xml to
{code}
<?xml version="1.0" encoding="windows-1250"?>
<konfig>
    <list><delimiter>;</delimiter></list>
    <key>
        <subkey>one;two;three</subkey>
        <subkey >four</subkey>
    </key>
    <c>${key.subkey(1)}</c>
</konfig>
{code}

even though I expect the same result what I got was:
{code}
c=four
x=four
1.6.0_07
{code}

Do I miss some point or {{setListDelimiter}} does not work for XML files?


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

Reply via email to