DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35315>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35315

           Summary: ConfigurationFactory not working as expected with
                    include path resolution
           Product: Commons
           Version: 1.1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P3
         Component: Configuration
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Documentation states that ConfigurationFactory searches includes in a directory
relative to the one including conf is located...

Actually, some problem in various initializer methods of ConfigurationFactory
makes it happen a way that is not natural.


ConfigurationFactory() empty constructor sets the basePath to ".". This is okay,
but when calling setConfigurationFileName, 
 
public void setConfigurationFileName(String configurationFileName)
    {
        File file = new File(configurationFileName).getAbsoluteFile();
        this.configurationFileName = file.getName();
        implicitBasePath = file.getParent();
    }


basePath is not reset to null... so a call to getBasePath will not return the
implicitBasePath as stated.

    public String getBasePath()
    {
        String path = StringUtils.isEmpty(basePath) ? implicitBasePath : 
basePath;
        return StringUtils.isEmpty(path) ? "." : path;
    }


using ConfigurationFactory(String configurationFileName) does not help, since it
does not use setConfigurationFileName , so it does not set implicitBasePath

    public ConfigurationFactory(String configurationFileName)
    {
        this.configurationFileName = configurationFileName;
    }

A work-around solution to these problems is to set the basePath to null
explicitely after instanciation/setup...


a possible correction is to modify the constructor and the setter like this:

    public ConfigurationFactory(String configurationFileName)
    {  
        setConfigurationFileName(configurationFileName);
    }

    public void setConfigurationFileName(String configurationFileName)
    {
        File file = new File(configurationFileName).getAbsoluteFile();
        this.configurationFileName = file.getName();
        this.basePath = null;
        implicitBasePath = file.getParent();
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to