commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30858] - [configuration] PropertyConfiguration.save() does not take basePath into account
Date Mon, 29 Nov 2004 18:59:22 GMT
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





------- Additional Comments From oliver.heger@t-online.de  2004-11-29 19:59 -------
I wrote a test case for saving a file based configuration with a base path, and
this still fails. The test should reproduce a situation as it occurs in
ConfigurationFactory: When a file based configuration is loaded, first its
setBasePath() method gets called and then setFileName(). To the former a URL may
be passed. If later the file based configuration should be saved using the
save() method or save(String) with a relative file name, conversion of this URL
to a File object fails.

A solution would be to make ConfigurationUtils.constructFile() aware of URLs, so
that a correct File object is constructed even if URLs are involved (given that
all URLs have the file protocol).

After looking at the code for a while I find our actual solution for dealing
with file names, base paths and URLs very confusing. The fact that we
distinguish between a base path and an URL makes the whole stuff hard to
maintain and error prone (just think about the many places in
ConfigurationFactory, AbstractFileConfiguration and elsewhere where special
checks are performed). Besides it is hard for the users to understand.

What can we do about it? I would suggest dropping (deprecating) either the
get/setURL() or get/setBasePath() methods. The remaining methods should be able
to deal with both URLs and files. This could be implemented in
ConfigurationUtils, in a central place. Are there any other ideas/opinions?

-- 
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message