01: /*
02: * @(#)AccessControlException.java 1.15 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package java.security;
29:
30: /**
31: * <p> This exception is thrown by the AccessController to indicate
32: * that a requested access (to a critical system resource such as the
33: * file system or the network) is denied.
34: *
35: * <p> The reason to deny access can vary. For example, the requested
36: * permission might be of an incorrect type, contain an invalid
37: * value, or request access that is not allowed according to the
38: * security policy. Such information should be given whenever
39: * possible at the time the exception is thrown.
40: *
41: * @version 1.9, 02/02/00
42: * @author Li Gong
43: * @author Roland Schemers
44: */
45:
46: public class AccessControlException extends SecurityException {
47:
48: // the permission that caused the exeception to be thrown.
49: private Permission perm;
50:
51: /**
52: * Constructs an <code>AccessControlException</code> with the
53: * specified, detailed message.
54: *
55: * @param s the detail message.
56: */
57: public AccessControlException(String s) {
58: super (s);
59: }
60:
61: /**
62: * Constructs an <code>AccessControlException</code> with the
63: * specified, detailed message, and the requested permission that caused
64: * the exception.
65: *
66: * @param s the detail message.
67: * @param p the permission that caused the exception.
68: */
69: public AccessControlException(String s, Permission p) {
70: super (s);
71: perm = p;
72: }
73:
74: /**
75: * Gets the Permission object associated with this exeception, or
76: * null if there was no corresponding Permission object.
77: *
78: * @return the Permission object.
79: */
80: public Permission getPermission() {
81: return perm;
82: }
83: }
|