Files
gcc/libjava/gnu/gcj/runtime/VMClassLoader.java
T
Bryce McKinlay 28f7d9d05a decl.c (init_decl_processing): Add new class "protectionDomain" field.
gcc/java:

2001-04-25  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* decl.c (init_decl_processing): Add new class "protectionDomain"
	field.
	* class.c (make_class_data): Set initial value for "protectionDomain".

libjava:

2001-04-25  Bryce McKinlay  <bryce@albatross.co.nz>

	java.security merge and ClassLoader compliance fixes.

	* java/lang/Class.h (Class): Include ProtectionDomain.h.
	New protectionDomain field.
	(forName): Add initialize parameter. Fixes declaration to comply with
	JDK spec.
	* java/lang/natClass.cc (forName): Correct declaration of the three-arg
	variant. Honour	"initialize" flag.
	(getProtectionDomain0): New method.
	* java/lang/Class.java: Fix forName() declaration.
	(getPackage): New method based on Classpath implementation.
	(getProtectionDomain0): New native method decl.
	(getProtectionDomain): New method.
	* java/lang/ClassLoader.java (getParent): Now final.
	(definedPackages): New field.
	(getPackage): New.
	(defineClass): New variant with protectionDomain argument.
	(definePackage): New.
	(getPackages): New.
	(findSystemClass): Now final.
	(getSystemResourceAsStream): Remove redundant "final" modifier.
	(getSystemResource): Remove redundant "final" modifier.
	(getResources): Now final.
	(protectionDomainPermission): New static field.
	(unknownProtectionDomain): Ditto.
	(defaultProtectionDomain): Ditto.
	(getSystemClassLoader): Now non-native.
	* java/util/ResourceBundle.java (tryGetSomeBundle): Use the correct
	arguments for Class.forName().
	* java/lang/Package.java: New file.
	* gnu/gcj/runtime/VMClassLoader.java (getVMClassLoader): Removed.
	(instance): Static initialize singleton.
	(findClass): Override this, not findSystemClass.
	* java/lang/natClassLoader.cc (defineClass0): Set class's
	protectionDomain field as specified.
	(getSystemClassLoader): Removed.
	(findClass): Renamed from findSystemClass. Call the interpreter via
	URLClassLoader.findClass if loading class via dlopen fails.

	* java/security/*.java: java.security import/merge with Classpath.
	* java/security/acl/*.java: Likewise.
	* java/security/interfaces/*.java: Likewise.
	* java/security/spec/*.java: Likewise.
	* java/net/NetPermission.java: Likewise.
	* java/net/SocketPermission.java: Likewise.
	* gnu/java/security/provider/DefaultPolicy.java: Likewise.

	* Makefile.am: Add new classes.
	* Makefile.in: Rebuilt.
	* gcj/javaprims.h: CNI namespace rebuild.

From-SVN: r41543
2001-04-25 16:45:15 +01:00

76 lines
1.9 KiB
Java

/* Copyright (C) 1999 Free Software Foundation
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. */
/* Author: Kresten Krab Thorup <krab@gnu.org> */
package gnu.gcj.runtime;
import java.io.*;
import java.util.StringTokenizer;
import java.net.URL;
final class VMClassLoader extends java.net.URLClassLoader
{
private VMClassLoader ()
{
super (init());
}
private static URL[] init()
{
StringTokenizer st
= new StringTokenizer (System.getProperty ("java.class.path", "."),
System.getProperty ("path.separator", ":"));
java.util.Vector p = new java.util.Vector();
while (st.hasMoreElements ())
{
String e = st.nextToken ();
try
{
if (e.endsWith(".jar") || e.endsWith (".zip"))
{
File archive = new File (e);
try {
p.addElement(new URL("jar", "", -1, "file://"
+ archive.getCanonicalPath ()
+ "!/"));
} catch (IOException ex) {
// empty
}
}
else if (e.endsWith ("/"))
p.addElement (new URL("file", "", -1, e));
else if (new File (e).isDirectory ())
p.addElement (new URL("file", "", -1, e + "/"));
else
/* Ignore path element. */;
}
catch (java.net.MalformedURLException x)
{
/* Ignore this path element */
}
}
URL[] urls = new URL[p.size()];
p.copyInto (urls);
return urls;
}
/** This is overridden to search the internal hash table, which
* will only search existing linked-in classes. This will make
* the default implementation of loadClass (in ClassLoader) work right.
* The implementation of this method is in java/lang/natClassLoader.cc.
*/
protected native Class findClass(String name)
throws java.lang.ClassNotFoundException;
// The only VMClassLoader that can exist.
public static VMClassLoader instance = new VMClassLoader ();
}