commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Attila Varga (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-648) wrong property key: PropertiesBuilderParametersImpl.PROP_IO_FACTORY
Date Tue, 20 Dec 2016 11:59:58 GMT
Attila Varga created CONFIGURATION-648:

             Summary: wrong property key: PropertiesBuilderParametersImpl.PROP_IO_FACTORY
                 Key: CONFIGURATION-648
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 2.1
            Reporter: Attila Varga

Example in user guide about using custom IOFactory doesn't work.


When you set an IOFactory like this:
        .setIOFactory(new WhitespaceIOFactory())

this custom IOFactory won't be set in your PropertiesConfiguration because 
the constant PropertiesBuilderParametersImpl.PROP_IO_FACTORY has the value:

FileBasedConfigurationBuilder tries to set the property "iOFactory" of PropertiesConfiguration
The method setiOFactory() exists not.

I have found a workaround, maybe this can explain better the problem:

//New subclass:
    public class PropertiesConfigurationOk extends PropertiesConfiguration {
        public void setiOFactory(IOFactory ioFactory)

//Usage of new subclass:
FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfigurationOk.class)

PropertiesConfiguration config = builder.getConfiguration();

This message was sent by Atlassian JIRA

View raw message