You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "achelon (JIRA)" <ji...@apache.org> on 2018/03/09 13:07:00 UTC

[jira] [Comment Edited] (CONFIGURATION-688) Including a property file moves locator to that file

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

achelon edited comment on CONFIGURATION-688 at 3/9/18 1:06 PM:
---------------------------------------------------------------

It is happening because in org.apache.commons.configuration2.PropertiesConfiguration#loadIncludeFile fh.load(url); line causes FileHandler to change locator field value in PropertiesConfiguration class making current working path to toBeIncluded.properties.

Beacause of that this works:
{code:java}
 # someDirectory/prop.properties
 include=../toBeIncluded.properties
 include=toBeIncluded2.properties{code}
But I would rather expect that include resolves file path in relation to file position in which it is defined.

The current behaviour would make a maintenance nightmare if toBeIncluded would include other files.


was (Author: achelon):
It is happening because in org.apache.commons.configuration2.PropertiesConfiguration#loadIncludeFile fh.load(url); line causes FileHandler to change locator field value in PropertiesConfiguration class making current working path to toBeIncluded.properties.

Beacause of that this works:
{code:java}
 # someDirectory/prop.properties
 include=../toBeIncluded.properties
 include=toBeIncluded2.properties{code}
But I would rather expect that include resolves file path in relation to file position in which it is defined.

> Including a property file moves locator to that file
> ----------------------------------------------------
>
>                 Key: CONFIGURATION-688
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-688
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: File reloading
>    Affects Versions: 2.2
>            Reporter: achelon
>            Priority: Major
>
> 1. Create files:
> {code:java}
> # toBeIncluded.properties
> some_prop=someValue{code}
> {code:java}
>  # toBeIncluded2.properties
> some_prop_2=someValue2
> {code}
> {code:java}
>  # someDirectory/prop.properties
> include=../toBeIncluded.properties
> include=../toBeIncluded2.properties
> {code}
> 2. Load someDirectory/prop.properties file
> Expected:
>  * Both files are loaded
> Actual:
>  * toBeIncluded2 cannot be loaded with org.apache.commons.configuration2.ex.ConfigurationException: Cannot resolve include file exception



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