You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2016/12/20 20:44:58 UTC

[jira] [Commented] (CONFIGURATION-648) wrong property key: PropertiesBuilderParametersImpl.PROP_IO_FACTORY

    [ https://issues.apache.org/jira/browse/CONFIGURATION-648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15765201#comment-15765201 ] 

Oliver Heger commented on CONFIGURATION-648:
--------------------------------------------

Thank you for spotting this.

I assume the problem is connected to a change in the last recent version of Commons Beanutils which is used behind the scenes to set the properties. Here the way how properties starting with multiple capital letters are handled has changed. To verify this assumption, you could try with the previous version of Beanutils, which should be 1.9.2.

Well that's annoying. This means that even if the problem is now fixed in Configuration, there are combinations of versions in the field which do not correctly work together.

> wrong property key: PropertiesBuilderParametersImpl.PROP_IO_FACTORY
> -------------------------------------------------------------------
>
>                 Key: CONFIGURATION-648
>                 URL: https://issues.apache.org/jira/browse/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.
> Link:
> https://commons.apache.org/proper/commons-configuration/userguide/howto_properties.html#Custom_properties_readers_and_writers
> 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)
>         {
>             super.setIOFactory(ioFactory);
>         }
>     }
> //Usage of new subclass:
> FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfigurationOk.class)                       .configure(propertiesBuilderParameters);
> PropertiesConfiguration config = builder.getConfiguration();



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)