01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Alexander V. Astapchuk
20: * @version $Revision$
21: */package java.security;
22:
23: /**
24: * Instances of this class are used to wrap exceptions which occur within
25: * privileged operations.
26: *
27: */
28: public class PrivilegedActionException extends Exception {
29:
30: /**
31: * @com.intel.drl.spec_ref
32: */
33: private static final long serialVersionUID = 4724086851538908602l;
34:
35: /**
36: * @com.intel.drl.spec_ref
37: */
38: private Exception exception;
39:
40: /**
41: * Constructs a new instance of this class with its exception filled in.
42: * @param ex
43: */
44: public PrivilegedActionException(Exception ex) {
45: super (ex);
46: this .exception = ex;
47: }
48:
49: /**
50: * Answers the exception which caused the receiver to be thrown.
51: * @return exception
52: */
53: public Exception getException() {
54: return exception; // return ( getCause() instanceof Exception ) ?
55: // getCause() : null;
56: }
57:
58: /**
59: * Answers the cause of this Throwable, or null if there is no cause.
60: *
61: *
62: * @return Throwable The receiver's cause.
63: */
64: public Throwable getCause() {
65: return exception;
66: }
67:
68: /**
69: * Answers a string containing a concise, human-readable description of the
70: * receiver.
71: *
72: *
73: * @return String a printable representation for the receiver.
74: */
75: public String toString() {
76: String s = getClass().getName();
77: return exception == null ? s : s + ": " + exception; //$NON-NLS-1$
78: }
79:
80: }
|