KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > AccessControlException


1 /*
2  * @(#)AccessControlException.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7  
8 package java.security;
9
10 /**
11  * <p> This exception is thrown by the AccessController to indicate
12  * that a requested access (to a critical system resource such as the
13  * file system or the network) is denied.
14  *
15  * <p> The reason to deny access can vary. For example, the requested
16  * permission might be of an incorrect type, contain an invalid
17  * value, or request access that is not allowed according to the
18  * security policy. Such information should be given whenever
19  * possible at the time the exception is thrown.
20  *
21  * @version 1.13, 12/19/03
22  * @author Li Gong
23  * @author Roland Schemers
24  */

25
26 public class AccessControlException extends SecurityException JavaDoc {
27
28     private static final long serialVersionUID = 5138225684096988535L;
29  
30     // the permission that caused the exeception to be thrown.
31
private Permission JavaDoc perm;
32
33     /**
34      * Constructs an <code>AccessControlException</code> with the
35      * specified, detailed message.
36      *
37      * @param s the detail message.
38      */

39     public AccessControlException(String JavaDoc s) {
40         super(s);
41     }
42
43     /**
44      * Constructs an <code>AccessControlException</code> with the
45      * specified, detailed message, and the requested permission that caused
46      * the exception.
47      *
48      * @param s the detail message.
49      * @param p the permission that caused the exception.
50      */

51     public AccessControlException(String JavaDoc s, Permission JavaDoc p) {
52         super(s);
53     perm = p;
54     }
55
56     /**
57      * Gets the Permission object associated with this exeception, or
58      * null if there was no corresponding Permission object.
59      *
60      * @return the Permission object.
61      */

62     public Permission JavaDoc getPermission() {
63     return perm;
64     }
65 }
66
67
Popular Tags