diff options
| author | Archie Cobbs <archie@dellroad.org> | 2005-01-07 15:08:21 +0000 |
|---|---|---|
| committer | Archie Cobbs <archie@dellroad.org> | 2005-01-07 15:08:21 +0000 |
| commit | ec858596f78dd4ddc318edd3d3f4ec537780c854 (patch) | |
| tree | ea7ebb6d209ae7bbc3a1c34e3bbbea043cfbc3ec /java/util/ResourceBundle.java | |
| parent | 53a43c88b4600340bd75f20120d26ed6afdc2065 (diff) | |
| download | classpath-ec858596f78dd4ddc318edd3d3f4ec537780c854.tar.gz | |
Re-committing now that the 0.13 release has been tagged:
* NEWS: Document changes.
* java/lang/Class.java (newInstance(), getClassLoader(),
forName(String), forName(String, boolean, ClassLoader)):
Use new VMStackWalker methods.
* java/lang/ClassLoader.java (getParent(), getSystemClassLoader()):
Likewise.
* java/lang/Package.java (getPackages()): Likewise.
* java/lang/SecurityManager.java (getClassContext()): Likewise.
* java/util/ResourceBundle.java (getBundle()): Likewise.
* java/lang/Runtime.java (load(), loadLibrary()): Load the native
library using the calling class' class loader.
* java/lang/System.java (load(), loadLibrary()): Likewise.
(currentClassLoader()): implement via currentLoadedClass().
* vm/reference/gnu/classpath/VMStackWalker.java: New class.
* vm/reference/java/lang/VMRuntime.java (nativeLoad()):
Add a ClassLoader parameter.
* vm/reference/java/lang/VMSecurityManager.java: Removed.
Diffstat (limited to 'java/util/ResourceBundle.java')
| -rw-r--r-- | java/util/ResourceBundle.java | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/java/util/ResourceBundle.java b/java/util/ResourceBundle.java index 8432b9a46..16dfed9e8 100644 --- a/java/util/ResourceBundle.java +++ b/java/util/ResourceBundle.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.util; +import gnu.classpath.VMStackWalker; import java.io.IOException; import java.io.InputStream; import java.security.AccessController; @@ -104,48 +105,6 @@ public abstract class ResourceBundle private Locale locale; /** - * We override SecurityManager in order to access getClassContext(). - */ - private static final class Security extends SecurityManager - { - /** - * Avoid accessor method of private constructor. - */ - Security() - { - } - - /** - * Return the ClassLoader of the class which called into this - * ResourceBundle, or null if it cannot be determined. - */ - ClassLoader getCallingClassLoader() - { - Class[] stack = getClassContext(); - for (int i = 0; i < stack.length; i++) - { - if (stack[i] != Security.class && stack[i] != ResourceBundle.class) - return stack[i].getClassLoader(); - } - - return null; - } - } - - /** A security context for grabbing the correct class loader. */ - private static final Security security - = (Security) AccessController.doPrivileged(new PrivilegedAction() - { - // This will always work since java.util classes have (all) system - // permissions. - public Object run() - { - return new Security(); - } - } - ); - - /** * The resource bundle cache. */ private static Map bundleCache; @@ -256,7 +215,7 @@ public abstract class ResourceBundle */ public static ResourceBundle getBundle(String baseName) { - ClassLoader cl = security.getCallingClassLoader(); + ClassLoader cl = VMStackWalker.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, Locale.getDefault(), cl); @@ -276,7 +235,7 @@ public abstract class ResourceBundle */ public static ResourceBundle getBundle(String baseName, Locale locale) { - ClassLoader cl = security.getCallingClassLoader(); + ClassLoader cl = VMStackWalker.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); |
