classpath
[Top][All Lists]
Advanced

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

Re: java.util.ResourceBundle bug?


From: Mark Wielaard
Subject: Re: java.util.ResourceBundle bug?
Date: Sat, 3 Nov 2001 16:57:49 +0100
User-agent: Mutt/1.3.23i

Hi,

On Sat, Nov 03, 2001 at 08:39:49AM -0700, Eric Blake wrote:
> 
> The problem here is that the supplied ClassLoader parameter may be null,
> if you intend for the proxy class to be created by the bootstrap
> loader.
I see. Then you could try to do a ClassLoader.getSystemClassLoader().
The spec says that this method may return null, but we could make it so
that the Classpath version always returns a non-null value.
(I have some code that makes the "systemClassLoader" an instance of
URLClassLoader, but I never had the time to actually finish, test, commit
that code.)

> For example, in javac you can create a proxy Runnable with null
> as its ClassLoader:
>   Proxy.newProxyInstance(null, new Class[]{Runnable.class}, myHandler);
> In order to create this class without a NullPointerException, you must
> defer to the secure VM entry point.
But does VMClassLoader have to be public for that?
(If letting getSystemClassLoader() always return a non-null ClassLoader is
somehow not an option)

Since java.lang.reflect.Proxy is system class is should always have enough
permissions to get at the package private static method of
java.lang.VMClassLoader (through AccessController.doPrivileged).
You could even cache the returned Method somewhere. Creating Proxy classes
already involves a lot of reflection so getting this particular method
also through reflection is not such a big deal (IMHO).

Cheers,

Mark
-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore



reply via email to

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