home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / security / AccessControlException.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  2.1 KB  |  72 lines

  1. /*
  2.  * @(#)AccessControlException.java    1.6 98/03/18
  3.  *
  4.  * Copyright 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17. /**
  18.  * <p> This exception is thrown by the AccessController to indicate
  19.  * that a requested access (to a critical system resource such as the
  20.  * file system or the network) is denied.
  21.  *
  22.  * <p> The reason to deny access can vary.  For example, the requested
  23.  * permission might be of an incorrect type,  contain an invalid
  24.  * value, or request access that is not allowed according to the
  25.  * security policy.  Such information should be given whenever
  26.  * possible at the time the exception is thrown.
  27.  *
  28.  * @version     1.6, 03/18/98
  29.  * @author Li Gong
  30.  * @author Roland Schemers
  31.  */
  32.  
  33. public class AccessControlException extends SecurityException {
  34.  
  35.     // the permission that caused the exeception to be thrown.
  36.     private Permission perm; 
  37.  
  38.     /**
  39.      * Constructs an <code>AccessControlException</code> with the
  40.      * specified, detailed message. 
  41.      *
  42.      * @param   s   the detail message.
  43.      */
  44.     public AccessControlException(String s) {
  45.         super(s);
  46.     }
  47.  
  48.     /**
  49.      * Constructs an <code>AccessControlException</code> with the
  50.      * specified, detailed message, and the requested permission that caused
  51.      * the exception. 
  52.      *
  53.      * @param   s   the detail message.
  54.      * @param   p   the permission that caused the exception.
  55.      */
  56.     public AccessControlException(String s, Permission p) {
  57.         super(s);
  58.     perm = p;
  59.     }
  60.  
  61.     /**
  62.      * Gets the Permission object associated with this exeception, or
  63.      * null if there was no corresponding Permission object.
  64.      *
  65.      * @return the Permission object.
  66.      */
  67.     public Permission getPermission() {
  68.     return perm;
  69.     }
  70. }
  71.  
  72.