Example usage for org.apache.commons.configuration2 PropertiesConfigurationLayout load

List of usage examples for org.apache.commons.configuration2 PropertiesConfigurationLayout load

Introduction

In this page you can find the example usage for org.apache.commons.configuration2 PropertiesConfigurationLayout load.

Prototype

public void load(final PropertiesConfiguration config, final Reader in) throws ConfigurationException 

Source Link

Document

Reads a properties file and stores its internal structure.

Usage

From source file:com.thoughtworks.go.agent.AgentAutoRegistrationPropertiesImpl.java

@Override
public void scrubRegistrationProperties() {
    if (!exist()) {
        return;/*from   w  ww  . j  av  a  2  s.  co  m*/
    }
    try {
        PropertiesConfiguration config = new PropertiesConfiguration();
        config.setIOFactory(new FilteringOutputWriterFactory());
        PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout();
        layout.setLineSeparator("\n");
        layout.load(config, reader());
        try (FileWriter out = new FileWriter(this.configFile)) {
            layout.save(config, out);
        }
        loadProperties();
    } catch (ConfigurationException | IOException e) {
        LOG.warn("[Agent Auto Registration] Unable to scrub registration key.", e);
    }
}