7eee682ba8
* Makefile.in: Rebuilt. * Makefile.am (core_java_source_files): Added UnsupportedClassVersionError. * java/lang/UnsupportedClassVersionError.java: New file from Classpath. * java/io/CharConversionException.java, java/io/EOFException.java, java/io/FileNotFoundException.java, java/io/IOException.java, java/io/InterruptedIOException.java, java/io/ObjectStreamException.java, java/io/OptionalDataException.java, java/io/StreamCorruptedException.java, java/io/SyncFailedException.java, java/io/UTFDataFormatException.java, java/io/UnsupportedEncodingException.java, java/lang/AbstractMethodError.java, java/lang/ArithmeticException.java, java/lang/ArrayIndexOutOfBoundsException.java, java/lang/ArrayStoreException.java, java/lang/ClassCastException.java, java/lang/ClassCircularityError.java, java/lang/ClassFormatError.java, java/lang/CloneNotSupportedException.java, java/lang/Error.java, java/lang/Exception.java, java/lang/ExceptionInInitializerError.java, java/lang/IllegalAccessError.java, java/lang/IllegalAccessException.java, java/lang/IllegalArgumentException.java, java/lang/IllegalMonitorStateException.java, java/lang/IllegalStateException.java, java/lang/IllegalThreadStateException.java, java/lang/IncompatibleClassChangeError.java, java/lang/IndexOutOfBoundsException.java, java/lang/InstantiationError.java, java/lang/InstantiationException.java, java/lang/InternalError.java, java/lang/InterruptedException.java, java/lang/LinkageError.java, java/lang/NegativeArraySizeException.java, java/lang/NoClassDefFoundError.java, java/lang/NoSuchFieldError.java, java/lang/NoSuchFieldException.java, java/lang/NoSuchMethodError.java, java/lang/NoSuchMethodException.java, java/lang/NullPointerException.java, java/lang/NumberFormatException.java, java/lang/OutOfMemoryError.java, java/lang/RuntimeException.java, java/lang/SecurityException.java, java/lang/StackOverflowError.java, java/lang/StringIndexOutOfBoundsException.java, java/lang/ThreadDeath.java, java/lang/UnknownError.java, java/lang/UnsatisfiedLinkError.java, java/lang/UnsupportedOperationException.java, java/lang/VerifyError.java, java/lang/VirtualMachineError.java, java/lang/reflect/InvocationTargetException.java, java/net/BindException.java, java/net/ConnectException.java, java/net/MalformedURLException.java, java/net/NoRouteToHostException.java, java/net/ProtocolException.java, java/net/SocketException.java, java/net/UnknownHostException.java, java/net/UnknownServiceException.java, java/text/ParseException.java: Copied from Classpath, thanks to Mark Wielaard who did the merge. * java/lang/System.java (getProperty): Use single argument form of SecurityManager.checkPropertyAccess. * Makefile.in: Rebuilt. * Makefile.am (core_java_source_files): Added VMSecurityManager. * java/lang/VMSecurityManager.java: New file. * java/lang/SecurityManager.java: Merged with Classpath. From-SVN: r45353
72 lines
2.2 KiB
Java
72 lines
2.2 KiB
Java
/*
|
|
* java.lang.SecurityManager: part of the Java Class Libraries project.
|
|
* Copyright (C) 1998, 2001 Free Software Foundation
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
package java.lang;
|
|
|
|
import java.net.*;
|
|
import java.util.*;
|
|
import java.io.*;
|
|
|
|
/**
|
|
** VMSecurityManager is a helper class for SecurityManager the VM must
|
|
** implement.
|
|
**
|
|
** @author John Keiser
|
|
** @version 1.1.0, 31 May 1998
|
|
**/
|
|
class VMSecurityManager
|
|
{
|
|
/** Get a list of all the classes currently executing
|
|
** methods on the Java stack. getClassContext()[0] is
|
|
** the currently executing method
|
|
** <STRONG>Spec Note:</STRONG> does not say whether
|
|
** the stack will include the getClassContext() call or
|
|
** the one just before it.
|
|
**
|
|
** @return an array containing all the methods on classes
|
|
** on the Java execution stack.
|
|
**/
|
|
static Class[] getClassContext()
|
|
{
|
|
// FIXME: can't yet implement this for libgcj.
|
|
return new Class[0];
|
|
}
|
|
|
|
/** Get the current ClassLoader--the one nearest to the
|
|
** top of the stack.
|
|
** @return the current ClassLoader.
|
|
**/
|
|
static ClassLoader currentClassLoader()
|
|
{
|
|
// The docs above are wrong. See the online docs.
|
|
// FIXME this implementation is a bit wrong too -- the docs say we
|
|
// must also consider ancestors of the system class loader.
|
|
Class[] classStack = getClassContext ();
|
|
for (int i = 0; i < classStack.length; i++)
|
|
{
|
|
ClassLoader loader = classStack[i].getClassLoader();
|
|
if (loader != null)
|
|
return loader;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|