Hi, On Thu, 2004-11-11 at 06:36, Steven Augart wrote: > The actual problem I'm seeing is that (after having done some > rearranging of the sequence in which we run static class initializers), > when I start up my VM, I get a nasty stack trace like this: > > Exception in thread "Jikes_RVM_Boot_Thread": > java.lang.ExceptionInInitializerError: Caught exception while invoking the > class initializer for java.net.URL > at com.ibm.JikesRVM.VM.runClassInitializer(VM.java:470) > at com.ibm.JikesRVM.VM.finishBooting(VM.java:242) > at com.ibm.JikesRVM.VM.boot(VM.java:108) > Caused by: java.lang.NullPointerException > at java.lang.System.getProperty(System.java:582) > at java.net.URL.<clinit>(URL.java:201) > at com.ibm.JikesRVM.VM.runClassInitializer(VM.java:466) > at com.ibm.JikesRVM.VM.finishBooting(VM.java:242) > at com.ibm.JikesRVM.VM.boot(VM.java:108) > JikesRVM: exit 113
Hmmm. That comes from some very old code that has probably never been used in practise. It allows people to disable the caching of URL protocol handlers. But since protocol handlers are always (and only) loaded through the system/application class loader it doesn't make that much sense to not cache them. And I doubt anyone ever ran any application with the gnu.java.net.nocache_protocol_handlers system property set to true. Would/Does the following patch help you out? 2004-11-12 Mark Wielaard <[EMAIL PROTECTED]> * java/net/URL.java (cache_handlers): Removed field. (static): Removed block. (getURLStreamHandler): Don't use cache_handlers anymore. If so, and nobody is really attached to the gnu.java.net.nocache_protocol_handlers system property then I would like to commit this. Cheers, Mark
Index: java/net/URL.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v retrieving revision 1.39 diff -u -r1.39 URL.java --- java/net/URL.java 15 Oct 2004 10:04:52 -0000 1.39 +++ java/net/URL.java 12 Nov 2004 13:27:07 -0000 @@ -104,13 +104,10 @@ * Please note that a protocol handler must be a subclass of * URLStreamHandler. * <p> - * Normally, this class caches protocol handlers. Once it finds a handler + * This class caches protocol handlers. Once it finds a handler * for a particular protocol, it never tries to look up a new handler - * again. However, if the system property - * gnu.java.net.nocache_protocol_handlers is set, then this - * caching behavior is disabled. This property is specific to this - * implementation. Sun's JDK may or may not do protocol caching, but it - * almost certainly does not examine this property. + * again. Protocol handlers are always (and only) loaded through the + * system class loader. * <p> * Please also note that an application can install its own factory for * loading protocol handlers (see setURLStreamHandlerFactory). If this is @@ -192,21 +189,6 @@ private static HashMap ph_cache = new HashMap(); /** - * Whether or not to cache protocol handlers. - */ - private static boolean cache_handlers; - - static - { - String s = System.getProperty("gnu.java.net.nocache_protocol_handlers"); - - if (s == null) - cache_handlers = true; - else - cache_handlers = false; - } - - /** * Constructs a URL and loads a protocol handler for the values passed as * arguments. * @@ -845,12 +827,8 @@ { URLStreamHandler ph = null; - // First, see if a protocol handler is in our cache. - if (cache_handlers) - { - if ((ph = (URLStreamHandler) ph_cache.get(protocol)) != null) - return ph; - } + if ((ph = (URLStreamHandler) ph_cache.get(protocol)) != null) + return ph; // If a non-default factory has been set, use it to find the protocol. if (factory != null) @@ -907,7 +885,7 @@ } // Update the hashtable with the new protocol handler. - if (ph != null && cache_handlers) + if (ph != null) ph_cache.put(protocol, ph); else ph = null;
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath