1 |
/* AccessControlException.java -- Permission is denied |
/* AccessControlException.java -- Permission is denied |
2 |
Copyright (C) 1998 Free Software Foundation, Inc. |
Copyright (C) 1998, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
39 |
|
|
40 |
/** |
/** |
41 |
* This exception is thrown when the <code>AccessController</code> denies |
* This exception is thrown when the <code>AccessController</code> denies |
42 |
* an attempt to perform an operation. |
* an attempt to perform an operation. This often keeps track of the |
43 |
|
* permission that was not granted. |
44 |
* |
* |
45 |
* @version 0.0 |
* @author Aaron M. Renn <arenn@urbanophile.com> |
46 |
* |
* @see AccessController |
47 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @status updated to 1.4 |
48 |
*/ |
*/ |
49 |
public class AccessControlException extends SecurityException |
public class AccessControlException extends SecurityException |
50 |
{ |
{ |
51 |
/** |
/** |
52 |
* The <code>Permission</code> associated with this exception |
* Compatible with JDK 1.1+. |
53 |
|
*/ |
54 |
|
private static final long serialVersionUID = 5138225684096988535L; |
55 |
|
|
56 |
|
/** |
57 |
|
* The <code>Permission</code> associated with this exception. |
58 |
|
* |
59 |
|
* @serial the permission |
60 |
*/ |
*/ |
61 |
private Permission perm; |
private final Permission perm; |
62 |
|
|
63 |
/** |
/** |
64 |
* This method initializes a new instance of <code>AccessControlException</code> |
* Create a new instance with a descriptive error message, and a null |
65 |
* with a descriptive error message. There will be no <code>Permission</code> |
* <code>Permission</code> object. |
|
* object associated with this exception. |
|
66 |
* |
* |
67 |
* @param msg The descriptive error message |
* @param msg the descriptive error message |
68 |
*/ |
*/ |
69 |
public AccessControlException(String msg) |
public AccessControlException(String msg) |
70 |
{ |
{ |
71 |
super(msg); |
this(msg, null); |
72 |
} |
} |
73 |
|
|
74 |
/** |
/** |
75 |
* This method initializes a new instance of <code>AccessControlException</code> |
* Create a new instance with a descriptive error message and an associated |
76 |
* with a descriptive error message and an instance of <code>Permission</code> |
* <code>Permission</code> object. |
|
* that is the permission that caused the exception to be thrown. |
|
77 |
* |
* |
78 |
* @param msg The descriptive error message |
* @param msg the descriptive error message |
79 |
* @param perm The <code>Permission</code> object that caused this exception. |
* @param perm the permission that caused this |
80 |
*/ |
*/ |
81 |
public AccessControlException(String msg, Permission perm) |
public AccessControlException(String msg, Permission perm) |
82 |
{ |
{ |
88 |
* This method returns the <code>Permission</code> object that caused |
* This method returns the <code>Permission</code> object that caused |
89 |
* this exception to be thrown. |
* this exception to be thrown. |
90 |
* |
* |
91 |
* @return The requested <code>Permission</code> object, or <code>null</code> if none is available. |
* @return the denied permission, or null |
92 |
*/ |
*/ |
93 |
public Permission getPermission() |
public Permission getPermission() |
94 |
{ |
{ |
95 |
return (perm); |
return perm; |
96 |
} |
} |
97 |
} |
} |