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 2018/09/18 20:11:00 UTC

[jira] [Commented] (CONFIGURATION-714) PropertiesConfiguration builder.getConfiguration fails

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

Oliver Heger commented on CONFIGURATION-714:
--------------------------------------------

According to the exception the file cannot be located. Does it exist in one of the folders that are searched for by default?

Please note that Jira is not a support forum. If you have questions about using the library, write a mail to the user mailing list: [http://commons.apache.org/proper/commons-configuration/mailing-lists.html]

> PropertiesConfiguration builder.getConfiguration fails
> ------------------------------------------------------
>
>                 Key: CONFIGURATION-714
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-714
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Tested on Windows 10 with Java 10.
>            Reporter: Jarek Sacha
>            Priority: Major
>
> Call to FileBasedConfigurationBuilder.getConfiguration fails with an exception:
> {noformat}
> Could not locate: org.apache.commons.configuration2.io.FileLocator@57fd91c9[fileName=usergui.properties,basePath=<null>,sourceURL=,encoding=ISO-8859-1,fileSystem=<null>,locationStrategy=<null>]
> org.apache.commons.configuration2.ex.ConfigurationException: Could not locate: org.apache.commons.configuration2.io.FileLocator@57fd91c9[fileName=usergui.properties,basePath=<null>,sourceURL=,encoding=ISO-8859-1,fileSystem=<null>,locationStrategy=<null>]
> 	at org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
> 	at org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
> 	at org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
> 	at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initFileHandler(FileBasedConfigurationBuilder.java:312)
> 	at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initResultInstance(FileBasedConfigurationBuilder.java:291)
> 	at org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder.initResultInstance(FileBasedConfigurationBuilder.java:60)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:421)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:285)
> {noformat}
> This can be reproduced with the example code from the User Guide [https://commons.apache.org/proper/commons-configuration/userguide/howto_properties.html#Using_PropertiesConfiguration]
>  {code:java}
> Parameters params = new Parameters();
> FileBasedConfigurationBuilder<FileBasedConfiguration> builder = 
>   new FileBasedConfigurationBuilder<FileBasedConfiguration(
>     PropertiesConfiguration.class)
>       .configure(params.properties()
>         .setFileName("usergui.properties")
>         .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
> Configuration config = builder.getConfiguration();
> config.setProperty("colors.background", "#000000");
> builder.save();
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)