--- /home/tromey/gnu/Nightly/classpath/classpath/java/util/ResourceBundle.java 2004-11-23 02:24:11.000000000 -0700 +++ java/util/ResourceBundle.java 2004-11-26 02:15:56.000000000 -0700 @@ -43,8 +43,6 @@ import java.io.InputStream; import java.lang.ref.Reference; import java.lang.ref.SoftReference; -import java.security.AccessController; -import java.security.PrivilegedAction; /** * A resource bundle contains locale-specific data. If you need localized @@ -105,47 +103,7 @@ */ 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(); - } - } - ); + private static native ClassLoader getCallingClassLoader(); /** * The resource bundle cache. @@ -258,7 +216,7 @@ */ public static ResourceBundle getBundle(String baseName) { - ClassLoader cl = security.getCallingClassLoader(); + ClassLoader cl = getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, Locale.getDefault(), cl); @@ -278,7 +236,7 @@ */ public static ResourceBundle getBundle(String baseName, Locale locale) { - ClassLoader cl = security.getCallingClassLoader(); + ClassLoader cl = getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl);