< prev index next >

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

Print this page




 253                     checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION);
 254                 }
 255             } finally {
 256                 inThreadGroupCheck = false;
 257             }
 258         }
 259     }
 260 
 261 
 262     /**
 263      * Throws a <code>SecurityException</code> if the
 264      * calling thread is not allowed to access the package specified by
 265      * the argument.
 266      * <p>
 267      * This method is used by the <code>loadClass</code> method of class
 268      * loaders.
 269      * <p>
 270      * The <code>checkPackageAccess</code> method for class
 271      * <code>SecurityManager</code>  calls
 272      * <code>checkPermission</code> with the
 273      * <code>RuntimePermission("accessClassInPackage."+pkg)</code>
 274      * permission.
 275      *
 276      * @param      pkg   the package name.
 277      * @exception  SecurityException  if the caller does not have
 278      *             permission to access the specified package.
 279      * @see        java.lang.ClassLoader#loadClass(java.lang.String, boolean)
 280      */
 281     public void checkPackageAccess(final String pkgname) {
 282 
 283         // first see if the VM-wide policy allows access to this package
 284         super.checkPackageAccess(pkgname);
 285 
 286         // now check the list of restricted packages
 287         for (Iterator<String> iter = restrictedPackages.iterator(); iter.hasNext();)
 288         {
 289             String pkg = iter.next();
 290 
 291             // Prevent matching "sun" and "sunir" even if they
 292             // starts with similar beginning characters
 293             //
 294             if (pkgname.equals(pkg) || pkgname.startsWith(pkg + "."))
 295             {
 296                 checkPermission(new java.lang.RuntimePermission




 253                     checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION);
 254                 }
 255             } finally {
 256                 inThreadGroupCheck = false;
 257             }
 258         }
 259     }
 260 
 261 
 262     /**
 263      * Throws a <code>SecurityException</code> if the
 264      * calling thread is not allowed to access the package specified by
 265      * the argument.
 266      * <p>
 267      * This method is used by the <code>loadClass</code> method of class
 268      * loaders.
 269      * <p>
 270      * The <code>checkPackageAccess</code> method for class
 271      * <code>SecurityManager</code>  calls
 272      * <code>checkPermission</code> with the
 273      * <code>RuntimePermission("accessClassInPackage."+ pkgname)</code>
 274      * permission.
 275      *
 276      * @param      pkgname   the package name.
 277      * @exception  SecurityException  if the caller does not have
 278      *             permission to access the specified package.
 279      * @see        java.lang.ClassLoader#loadClass(java.lang.String, boolean)
 280      */
 281     public void checkPackageAccess(final String pkgname) {
 282 
 283         // first see if the VM-wide policy allows access to this package
 284         super.checkPackageAccess(pkgname);
 285 
 286         // now check the list of restricted packages
 287         for (Iterator<String> iter = restrictedPackages.iterator(); iter.hasNext();)
 288         {
 289             String pkg = iter.next();
 290 
 291             // Prevent matching "sun" and "sunir" even if they
 292             // starts with similar beginning characters
 293             //
 294             if (pkgname.equals(pkg) || pkgname.startsWith(pkg + "."))
 295             {
 296                 checkPermission(new java.lang.RuntimePermission


< prev index next >