commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (CONFIGURATION-373) HierarchicalConfiguration: adding a new branch using index (-1) does not work
Date Sat, 21 Mar 2009 16:11:50 GMT

     [ https://issues.apache.org/jira/browse/CONFIGURATION-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oliver Heger resolved CONFIGURATION-373.
----------------------------------------

       Resolution: Invalid
    Fix Version/s: 1.7

Thanks for your feedback. So closing this ticket as invalid.

> HierarchicalConfiguration: adding a new branch using index (-1) does not work
> -----------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-373
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-373
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 1.6
>         Environment: W2003, JDK 1.6
>            Reporter: Antoine Morpain
>             Fix For: 1.7
>
>
> {code}
> addProperty("profiles.profile.name", "QAL");
> addProperty("profiles.profile(-1).name", "PROD");         // <-  index  (-1)   to
create a NEW branch
> // see: http://commons.apache.org/configuration/userguide/howto_xml.html#Hierarchical_properties
- "Adding new properties"
> {code}
> should create a config like (XML view):
> {code:xml}
> <configuration>
>                 <profiles>
>                                <profile>
>                                                <name>QAL</name>
>                                </profile>
>                                <profile>
>                                                <name>PROD</name>
>                                </profile>
>                 </profiles>
> </configuration>
> {code}
> but it does this:
> {code:xml}
> <configuration>
>                 <profiles>
>                                <profile>
>                                                <name>QAL</name>         
                        <- QAL and PROD
>                                                <name>PROD</name>        
                      <- in the same branch !
>                                </profile>
>                 </profiles>
> </configuration>
> {code}
> Test program:
> {code}
> import org.apache.commons.configuration.ConfigurationException;
> import org.apache.commons.configuration.HierarchicalConfiguration;
> import org.apache.commons.configuration.XMLConfiguration;
> public class Main {
>                                public void doit(String[] args) throws ConfigurationException{
>                                                HierarchicalConfiguration hc=new HierarchicalConfiguration();
>                                                hc.addProperty("profiles.profile.name",
"QAL");
>                                                hc.addProperty("profiles.profile(-1).name",
"PROD");
>                                                XMLConfiguration x1=new XMLConfiguration();
>                                                x1.append(hc);
>                                                x1.save("conf.xml");
>                                                System.exit(0);
>                                }
>                 
>     public static void main(String[] args) throws ConfigurationException {
>         Main main = new Main();
>         main.doit(args);
>     }
> }
> {code}

-- 
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