Commit 092b50e2 by Nathan Bryant Committed by Tom Tromey

re PR libgcj/12001 (_Jv_FindClass dumps core when Oracle's classes12.zip in $CLASSPATH)

	PR libgcj/12001:
	* gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Pass empty
	array to superclass.
	(init): Changed interface; add URLs here.
	(initialize): New static method.
	* prims.cc (_Jv_CreateJavaVM): Initialize ClassLoader here...
	(_Jv_RunMain): ... not here.

Co-Authored-By: Tom Tromey <tromey@redhat.com>

From-SVN: r75889
parent 84568e14
2004-01-14 Nathan Bryant <nbryant@optonline.net>
Tom Tromey <tromey@redhat.com>
PR libgcj/12001:
* gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Pass empty
array to superclass.
(init): Changed interface; add URLs here.
(initialize): New static method.
* prims.cc (_Jv_CreateJavaVM): Initialize ClassLoader here...
(_Jv_RunMain): ... not here.
2004-01-14 Michael Koch <konqueror@gmx.de> 2004-01-14 Michael Koch <konqueror@gmx.de>
* java/text/MessageFormat.java: * java/text/MessageFormat.java:
...@@ -8,7 +19,7 @@ ...@@ -8,7 +19,7 @@
* java/awt/EventQueue.java (isDispatchThread): Do check on top of stack. * java/awt/EventQueue.java (isDispatchThread): Do check on top of stack.
(push): Make sure push is performed at the top of the thread stack. (push): Make sure push is performed at the top of the thread stack.
2004-01-13 Thomas Fitzsimmons <fitzsim@redhat.com> 2004-01-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkTextAreaPeer.java, * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
......
/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation /* Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -19,7 +19,7 @@ public final class VMClassLoader extends java.net.URLClassLoader ...@@ -19,7 +19,7 @@ public final class VMClassLoader extends java.net.URLClassLoader
{ {
private VMClassLoader () private VMClassLoader ()
{ {
super (init()); super (new URL[0]);
String p String p
= System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control", = System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control",
""); "");
...@@ -36,22 +36,21 @@ public final class VMClassLoader extends java.net.URLClassLoader ...@@ -36,22 +36,21 @@ public final class VMClassLoader extends java.net.URLClassLoader
lib_control = LIB_FULL; lib_control = LIB_FULL;
} }
private static URL[] init() private void init()
{ {
StringTokenizer st StringTokenizer st
= new StringTokenizer (System.getProperty ("java.class.path", "."), = new StringTokenizer (System.getProperty ("java.class.path", "."),
System.getProperty ("path.separator", ":")); System.getProperty ("path.separator", ":"));
java.util.Vector p = new java.util.Vector();
while (st.hasMoreElements ()) while (st.hasMoreElements ())
{ {
String e = st.nextToken (); String e = st.nextToken ();
try try
{ {
if (!e.endsWith (File.separator) && new File (e).isDirectory ()) if (!e.endsWith (File.separator) && new File (e).isDirectory ())
p.addElement (new URL("file", "", -1, e + File.separator)); addURL(new URL("file", "", -1, e + File.separator));
else else
p.addElement (new URL("file", "", -1, e)); addURL(new URL("file", "", -1, e));
} }
catch (java.net.MalformedURLException x) catch (java.net.MalformedURLException x)
{ {
...@@ -62,16 +61,12 @@ public final class VMClassLoader extends java.net.URLClassLoader ...@@ -62,16 +61,12 @@ public final class VMClassLoader extends java.net.URLClassLoader
// compiled into this executable may be found. // compiled into this executable may be found.
try try
{ {
p.addElement (new URL("core", "", -1, "/")); addURL(new URL("core", "", -1, "/"));
} }
catch (java.net.MalformedURLException x) catch (java.net.MalformedURLException x)
{ {
// This should never happen. // This should never happen.
} }
URL[] urls = new URL[p.size()];
p.copyInto (urls);
return urls;
} }
/** This is overridden to search the internal hash table, which /** This is overridden to search the internal hash table, which
...@@ -82,6 +77,13 @@ public final class VMClassLoader extends java.net.URLClassLoader ...@@ -82,6 +77,13 @@ public final class VMClassLoader extends java.net.URLClassLoader
protected native Class findClass(String name) protected native Class findClass(String name)
throws java.lang.ClassNotFoundException; throws java.lang.ClassNotFoundException;
// This can be package-private because we only call it from native
// code during startup.
static void initialize ()
{
instance.init();
}
// This keeps track of shared libraries we've already tried to load. // This keeps track of shared libraries we've already tried to load.
private HashSet tried_libraries = new HashSet(); private HashSet tried_libraries = new HashSet();
......
// prims.cc - Code for core of runtime environment. // prims.cc - Code for core of runtime environment.
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -927,15 +927,24 @@ _Jv_CreateJavaVM (void* /*vm_args*/) ...@@ -927,15 +927,24 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
_Jv_InitClass (&java::lang::VMThrowable::class$); _Jv_InitClass (&java::lang::VMThrowable::class$);
java::lang::VMThrowable::trace_enabled = 0; java::lang::VMThrowable::trace_enabled = 0;
// We have to initialize this fairly early, to avoid circular class
// initialization. In particular we want to start the
// initialization of ClassLoader before we start the initialization
// of VMClassLoader.
_Jv_InitClass (&java::lang::ClassLoader::class$);
// Once the bootstrap loader is in place, change it into a kind of
// system loader, by having it read the class path.
gnu::gcj::runtime::VMClassLoader::initialize();
INIT_SEGV; INIT_SEGV;
#ifdef HANDLE_FPE #ifdef HANDLE_FPE
INIT_FPE; INIT_FPE;
#endif #endif
no_memory = new java::lang::OutOfMemoryError; no_memory = new java::lang::OutOfMemoryError;
java::lang::VMThrowable::trace_enabled = 1; java::lang::VMThrowable::trace_enabled = 1;
#ifdef USE_LTDL #ifdef USE_LTDL
LTDL_SET_PRELOADED_SYMBOLS (); LTDL_SET_PRELOADED_SYMBOLS ();
#endif #endif
...@@ -988,12 +997,6 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, ...@@ -988,12 +997,6 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
arg_vec = JvConvertArgv (argc - 1, argv + 1); arg_vec = JvConvertArgv (argc - 1, argv + 1);
#endif #endif
// We have to initialize this fairly early, to avoid circular
// class initialization. In particular we want to start the
// initialization of ClassLoader before we start the
// initialization of VMClassLoader.
_Jv_InitClass (&java::lang::ClassLoader::class$);
using namespace gnu::gcj::runtime; using namespace gnu::gcj::runtime;
if (klass) if (klass)
main_thread = new FirstThread (klass, arg_vec); main_thread = new FirstThread (klass, arg_vec);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment