Class SecurityExceptionEx
public class SecurityExceptionEx extends SecurityException
{
// Constructors
public SecurityExceptionEx();
public SecurityExceptionEx(String s);
// Methods
public String getFailingClassName();
public String getFailingMethodName();
public String toString();
}
This class represents security exceptions that are thrown by a component of the security system to indicate a security violation. The SecurityExceptionEx class differs from the standard java.lang.SecurityException class in that it can also keep track of who caused the security violation.
This extended behavior of a SecurityExceptionEx object is currently useful only within the IPermission.check method. If an IPermission.check method, which has been called by the Microsoft Win32 VM for Java in response to one of the PolicyEngine.checkPermission APIs, throws an instance of SecurityExceptionEx, the Microsoft VM will fill in the class and method names of the stack frame that failed the check. SecurityExceptionEx instances that are thrown in other contexts do not contain the class and method name information, and the getFailingClassName and getFailingMethodName methods will then return null.
SecurityException
|
+--SecurityExceptionEx
public SecurityExceptionEx();
Creates a new SecurityExceptionEx object with no detail message.
public SecurityExceptionEx(String s);
Creates a new SecurityExceptionEx object based on the specified detail message.
Parameter | Description |
s
| The detail message.
|
public String getFailingClassName();
Retrieves the name of the class that caused the security violation. Typically, this would be the class type of a caller (found on the call stack) that lacked the proper permissions to satisfy a permission-based security check using the PolicyEngine class.
Return Value:
Returns the name of the class that caused the security violation. This value might be null, depending on the context in which the SecurityExceptionEx is thrown.
public String getFailingMethodName();
Retrieves the name of a specific method, found on the call stack, that caused a security violation. Typically, a security violation occurs when the class associated with the method lacks the proper permissions to satisfy a permission-based security check using the PolicyEngine class.
Return Value:
Returns the name of the method that caused the security violation. This value might be null, depending on the context in which the SecurityExceptionEx is thrown.
public String toString();
Converts the SecurityExceptionEx object to its string representation.
Return Value:
Returns the string representation of the SecurityExceptionEx object.
Remarks:
The representation of a SecurityExceptionEx differs slightly from the standard java.lang.Throwable output in that it also includes the class and method name of the stack frame that caused the security violation.
The string representation of a SecurityExceptionEx object is shown in the following example.
<ex-name>[<class>.<method>]: <detail>
or
<ex-name>[Unknown]: <detail>
The bracketed names have the following meanings.
- <ex-name>
- The name of the exception (com.ms.security.SecurityExceptionEx).
- <class>
- The name of the failing class.
- <method>
- The name of the failing method.
- <detail>
- The detail message.