Hello

I�ve problems with my first configuration use.

I want to try to load a config file, if it fails,
create a new one.

My code is:

+++++++++++++++++++++++++++++

try {
            pc = new PropertiesConfiguration("a.ini");


        } catch (ConfigurationException ce) {
            try {
                pc = new PropertiesConfiguration();
                pc.addProperty("dbClassName",
"SQLite.JDBCDriver");
                pc.addProperty("dbURL",
"jdbc:sqlite://sogox.db");
                pc.addProperty("phonesFilePath",
"c:\\\\");
                pc.save("a.ini");
                
            } catch (ConfigurationException ce1) {
                System.err.println(ce.getMessage());
            }
        }

++++++++++++++++++++++++++++++

but, I received a error message:

Exception in thread "main"
java.lang.NullPointerException
        at
org.apache.commons.configuration.ConfigurationUtils.getBasePath(Confi
gurationUtils.java:337)


I guess it�s due to the fact that the file doesn�t
exist and then new PropertiesConfiguration gives a
null value.

Well, my doubt is how should I do this ? which is the
"best practice" ? should I use xml instead of
properties ?


Thanks in advance

Javier




                
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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

Reply via email to