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

Oliver Heger commented on CONFIGURATION-463:
--------------------------------------------

Your observation is correct, {{AbstractFileConfiguration}} indeed changes its 
internal base path the first time a file is loaded. It behaves this way for a 
long time, so it is probably a bad idea to change this now (at least in the 1.x 
series).

But you are right, the documentation should mention this behavior.
                
> AbstractFileConfiguration.load(String filename) returns with current 
> directory changed
> --------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-463
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-463
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6, 1.7
>         Environment: Windows7, Linux (Fedora14)
>            Reporter: James Garrison
>
> {code:java}
>     PropertiesConfiguration pc = new PropertiesConfiguration();
>     ...
>     for (String f : cl.getArgs())
>     {
>         pc.load(f);
>     }
> {code}
> Invoked in directory /home/me/test with several relative paths, i.e. 
> ./sub1/a.cfg ./sub2/b.cfg
> First file loads successfully. Upon return from the first invocation of 
> pc.load(f), the current directory has been changed to the absolute path of 
> the loaded file (/home/me/test/sub1).  Thus, subsequent paths given as 
> relative references to the original user.dir fail to be found.
> If this is the expected behavior, it should be documented.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to