You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/08/26 09:30:59 UTC
DO NOT REPLY [Bug 30858] -
Save of properties in PropertyConfiguration does not take basePath into account
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=30858>.
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=30858
Save of properties in PropertyConfiguration does not take basePath into account
------- Additional Comments From hermod.opstvedt@dnb.no 2004-08-26 07:30 -------
I discovered that the basePath can contain 'file:/' in the beginning, so I
propose to add a new method to BasePathConfiguration :
/**
* Returns the Base path from which this Configuration Factory operates.
* This is never null. If you set the BasePath to null, then "."
* is returned. If the basePath is prefixed with a protocol then remove it
*
* @return The base Path of this configuration factory.
*/
public String getAbsoluteBasePath()
{
if(basePath.indexOf("file:/") > -1)
{
return basePath.substring(basePath.indexOf("file:/")+6);
}
else
{
return basePath;
}
}
and then in PropertiesConfiguration :
/**
* Save the configuration to the file specified by the fileName attribute.
*/
public void save() throws ConfigurationException
{
// save(fileName);
save(getAbsoluteBasePath());
}
Again : I don't have CVS access, so I submit it here
Hermod
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org