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 2005/11/25 22:54:16 UTC
DO NOT REPLY [Bug 37642] New: -
[resources] Improve ResourcesBase method inter-operability
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=37642>.
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=37642
Summary: [resources] Improve ResourcesBase method inter-
operability
Product: Commons
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P1
Component: Resources
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: niallp@apache.org
The Resources interface defines the following four methods for retrieving
content, in addition to the getObject() method:
public String getString(String key, Locale locale, TimeZone timeZone);
public byte[] getBytes(String key, Locale locale, TimeZone timeZone);
public Reader getReader(String key, Locale locale, TimeZone timeZone);
public InputStream getInputStream(String key, Locale locale, TimeZone
timeZone);
The ResourcesBase class implements these by converting the object returned from
the getObject() method first to a String before converting it on to the
required return type.
IMO this is very limiting, since if for example the getObject() method returns
a java.io.Reader and the getReader() method is called then this implementation
will convert that Reader to a String using the Reader's toString() method and
then return a StringReader using the converted String. It would be better in
this instance if the original retrieved Reader was simply returned.
I'm attaching a patch which improves the implementation of the above four
methods so that it handles conversion between these return types in a better
way. This will (hopefully) make these methods inter-operable - meaning the user
can choose any of the four methods to retrieve the content and whatever of
these four types getObject() returns, any of the methods should work.
Also in the patch is changes to ResourceBundleResources to remove the current
implementations of these four methods (three of which currently throw
UnsupportedOoperationException) to rely on these new implementations inherited
from ResourcesBase.
--
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