Example usage for org.apache.commons.configuration XMLConfiguration save

List of usage examples for org.apache.commons.configuration XMLConfiguration save

Introduction

In this page you can find the example usage for org.apache.commons.configuration XMLConfiguration save.

Prototype

public void save() throws ConfigurationException 

Source Link

Usage

From source file:pl.otros.logview.persistance.PersistentConfiguration.java

private static XMLConfiguration getXMLConfiguration(String file) {
    XMLConfiguration xmlConfiguration = new XMLConfiguration();
    try {//from   ww w.j a va  2 s. c o m
        xmlConfiguration = new XMLConfiguration();
        xmlConfiguration.setFile(new File(file));
        xmlConfiguration.load();
        xmlConfiguration.setAutoSave(true);
    } catch (ConfigurationException e) {
        LOGGER.severe("Can't load configuration, creating new " + e.getMessage());

        try {
            xmlConfiguration.save();
            xmlConfiguration.setAutoSave(true);
        } catch (ConfigurationException e1) {
            LOGGER.severe("Can't create persistent configuration: " + e1.getMessage());
        }
    }
    return xmlConfiguration;
}