src/share/classes/sun/applet/AppletSecurity.java

Print this page
rev 10175 : 8042872: Fix raw and unchecked warnings in sun.applet
Reviewed-by:

*** 78,102 **** public AppletSecurity() { reset(); } // Cache to store known restricted packages ! private HashSet restrictedPackages = new HashSet(); /** * Reset from Properties */ public void reset() { // Clear cache restrictedPackages.clear(); ! AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Enumerate system properties ! Enumeration e = System.getProperties().propertyNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); --- 78,102 ---- public AppletSecurity() { reset(); } // Cache to store known restricted packages ! private HashSet<String> restrictedPackages = new HashSet<>(); /** * Reset from Properties */ public void reset() { // Clear cache restrictedPackages.clear(); ! AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { // Enumerate system properties ! Enumeration<?> e = System.getProperties().propertyNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement();
*** 128,138 **** if ((loader == null) || (loader instanceof AppletClassLoader)) return (AppletClassLoader)loader; // if that fails, get all the classes on the stack and check them. ! Class[] context = getClassContext(); for (int i = 0; i < context.length; i++) { loader = context[i].getClassLoader(); if (loader instanceof AppletClassLoader) return (AppletClassLoader)loader; } --- 128,138 ---- if ((loader == null) || (loader instanceof AppletClassLoader)) return (AppletClassLoader)loader; // if that fails, get all the classes on the stack and check them. ! Class<?>[] context = getClassContext(); for (int i = 0; i < context.length; i++) { loader = context[i].getClassLoader(); if (loader instanceof AppletClassLoader) return (AppletClassLoader)loader; }
*** 146,157 **** */ for (int i = 0; i < context.length; i++) { final ClassLoader currentLoader = context[i].getClassLoader(); if (currentLoader instanceof URLClassLoader) { ! loader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { ! public Object run() { AccessControlContext acc = null; ProtectionDomain[] pds = null; try { --- 146,158 ---- */ for (int i = 0; i < context.length; i++) { final ClassLoader currentLoader = context[i].getClassLoader(); if (currentLoader instanceof URLClassLoader) { ! loader = AccessController.doPrivileged( ! new PrivilegedAction<ClassLoader>() { ! public ClassLoader run() { AccessControlContext acc = null; ProtectionDomain[] pds = null; try {
*** 280,292 **** // first see if the VM-wide policy allows access to this package super.checkPackageAccess(pkgname); // now check the list of restricted packages ! for (Iterator iter = restrictedPackages.iterator(); iter.hasNext();) { ! String pkg = (String) iter.next(); // Prevent matching "sun" and "sunir" even if they // starts with similar beginning characters // if (pkgname.equals(pkg) || pkgname.startsWith(pkg + ".")) --- 281,293 ---- // first see if the VM-wide policy allows access to this package super.checkPackageAccess(pkgname); // now check the list of restricted packages ! for (Iterator<String> iter = restrictedPackages.iterator(); iter.hasNext();) { ! String pkg = iter.next(); // Prevent matching "sun" and "sunir" even if they // starts with similar beginning characters // if (pkgname.equals(pkg) || pkgname.startsWith(pkg + "."))