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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]