Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.1
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
35316
Description
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(); }