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 37642] New: - [resources] Improve ResourcesBase method inter-operability
Date Fri, 25 Nov 2005 21:54:16 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=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


Mime
View raw message