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 2011/04/08 11:59:06 UTC

[jira] [Resolved] (CONFIGURATION-437) BasePath not set on with DefaultConfigurationBuilder/ConfigurationBuilderProvider

     [ https://issues.apache.org/jira/browse/CONFIGURATION-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-437.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.7

A fix was applied in revision 1090176 which is a bit more broader: The most important properties of the current DefaultConfigurationBuilder are now inherited by child builders. This includes the base path.

> BasePath not set on with DefaultConfigurationBuilder/ConfigurationBuilderProvider
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-437
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-437
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6, Nightly Builds
>            Reporter: Mike Noordermeer
>            Assignee: Oliver Heger
>             Fix For: 1.7
>
>         Attachments: basepath.patch
>
>
> The DefaultConfigurationBuilder does not set the basepath of nested DefaultConfigurationBuilders:
> I've the following structure:
> /WEB-INF/config/defs/def-1.xml
> /WEB-INF/config/defs/def-2.xml
> /WEB-INF/config/config1.properties
> I use a DefaultConfigurationBuilder, with the following contents in the
> def-1.xml:
> <configuration>
> <override>
> <properties fileName="../config1.properties"/>
> <configuration fileName="def-2.xml"/>
> </override>
> </configuration>
> I use this code:
> DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
> builder.setURL(ctx.getResource("/WEB-INF/config/defs/def-1.xml"));
> Configuration c = builder.getConfiguration(true);
> This gives an exception:
> Caused by: org.apache.commons.configuration.ConfigurationException:
> Cannot locate configuration source def-2.xml
> at
> org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:217)
> [...]
> Seems to be that AbstractFileConfiguration.basePath is not set by the
> DefaultConfigurationBuilder.ConfigurationBuilderProvider, while it is
> set by DefaultConfigurationBuilder.FileConfigurationProvider (in
> initBeanInstance(Object, BeanDeclaration)).
> I'll attach a quick n dirty fix against 1.6 (can't get trunk to build), but I doubt it's the best fix. It's just a copy of FileConfigurationProvider#initBeanInstance in ConfigurationBuilderProvider.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira