aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2006-08-07 14:48:59 +0000
committerGary Benson <gary@gcc.gnu.org>2006-08-07 14:48:59 +0000
commitded9dbb8948c50aec540d382846b8a554d31e007 (patch)
tree6cf536258c857420080043168abdc63d0bbff7e1 /libjava/java/net
parentda0f033486c5ba410fac5c4296e562ee22a0a3e9 (diff)
downloadgcc-ded9dbb8948c50aec540d382846b8a554d31e007.zip
gcc-ded9dbb8948c50aec540d382846b8a554d31e007.tar.gz
gcc-ded9dbb8948c50aec540d382846b8a554d31e007.tar.bz2
re PR libgcj/28340 (gij ignores -Djava.security.manager)
2006-08-07 Gary Benson <gbenson@redhat.com> PR libgcj/28340: * java/lang/ClassLoader.java (clinit): Install a default security manager if java.security.manager is defined. (getParent, getSystemClassLoader): Use the correct stack frame during security checks. * java/net/URLClassLoader.java (findClass): Avoid calling this.toString() during VM initialization. (runtimeInitialized): New method. * java/net/natURLClassLoader.cc: New file. * Makefile.am (nat_source_files): Added the above. * Makefile.in: Rebuilt. From-SVN: r115999
Diffstat (limited to 'libjava/java/net')
-rw-r--r--libjava/java/net/URLClassLoader.java14
-rw-r--r--libjava/java/net/natURLClassLoader.cc22
2 files changed, 35 insertions, 1 deletions
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index ada4b63..06db7d5 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -1078,7 +1078,12 @@ public class URLClassLoader extends SecureClassLoader
resource = loader.getResource(resourceName);
}
if (resource == null)
- throw new ClassNotFoundException(className + " not found in " + this);
+ {
+ String message = className + " not found";
+ if (runtimeInitialized())
+ message += " in " + this;
+ throw new ClassNotFoundException(message);
+ }
// Try to read the class data, create the CodeSource, Package and
// construct the class (and watch out for those nasty IOExceptions)
@@ -1437,4 +1442,11 @@ public class URLClassLoader extends SecureClassLoader
return loader;
}
}
+
+ /**
+ * Tell whether runtime initialization is complete.
+ *
+ * @return whether runtime initialization is complete.
+ */
+ private static native boolean runtimeInitialized();
}
diff --git a/libjava/java/net/natURLClassLoader.cc b/libjava/java/net/natURLClassLoader.cc
new file mode 100644
index 0000000..ead0db4
--- /dev/null
+++ b/libjava/java/net/natURLClassLoader.cc
@@ -0,0 +1,22 @@
+// natURLClassLoader.cc -- Native part of the URLClassLoader class.
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <java/net/URLClassLoader.h>
+
+jboolean
+java::net::URLClassLoader::runtimeInitialized ()
+{
+ return gcj::runtimeInitialized;
+}