classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: FYI: More efficient ResourceBundle calls


From: Mark Wielaard
Subject: Re: Patch: FYI: More efficient ResourceBundle calls
Date: Tue, 15 Jun 2004 22:42:15 +0200

Hi,

On Tue, 2004-06-15 at 16:56, Bryce McKinlay wrote:
> I'm checking in this patch from libgcj. It changes various
> ResourceBundle.getBundle() calls to use the 3-argument form which
> includes a ClassLoader parameter. This call is  more efficient because
> it means getBundle() does not have to walk the stack to find the
> calling classloader. This should speed up some Date/Calendar
> operations which are currently quite slow due to repeated calling
> classloader checks. Other VMs may implement the classloader check
> faster than libgcj does currently, however it will presumably always
> be faster to pass the classloader explicitly - so please use the
> 3-argument form when adding new getBundle() calls.

This looks a bit bogus to me.

> -    return ResourceBundle.getBundle(bundleName, locale);
> +    return ResourceBundle.getBundle(bundleName, locale,
> +      Calendar.class.getClassLoader());

In every case you call getClassLoader() on a bootstrap class. So you
already know that it will be null. So you could have just passed in null
as loader. But ResourceBundle.getBundle() is documented to throw a
NullPointerException when any of its arguments is null. It seems we have
a bug because we don't throw a NullPointerException (we used to throw it
when we used HashTable, but we switched to HashMap which allows null
values), but the kaffe implementation does (IMHO correctly) throw a
NullPointerException.

I do admit that ResourceBundle is poorly documented (the new getBundle()
call isn't documented in my Java Class Libraries Second Edition
Supplemental).

Cheers,

Mark

BTW. We now use the address@hidden for patch submissions and
discussions. We would actually like to have a separate patch list and
have the automatic commit messages on commit-classpath again so the main
classpath mailing-list will be free for general discussion.
Waiting for the Savannah TODO list to clear:
http://lists.gnu.org/archive/html/savannah-hackers/2004-06/msg00101.html
(If someone has time to help out...)

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]