Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1
-
None
-
None
Description
Example in user guide about using custom IOFactory doesn't work.
When you set an IOFactory like this:
params.properties()
.setFileName("myfile.properties")
.setIOFactory(new WhitespaceIOFactory())
this custom IOFactory won't be set in your PropertiesConfiguration because
the constant PropertiesBuilderParametersImpl.PROP_IO_FACTORY has the value:
"iOFactory".
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) .configure(propertiesBuilderParameters);
PropertiesConfiguration config = builder.getConfiguration();