1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.pluto.portlet.admin;
17
18 /***
19 * The main application exception that is a RuntimeException and
20 * can wrap an underlying exception (i.e. the cause).
21 *
22 * @author Craig Doremus
23 *
24 */
25 public class PlutoAdminException extends RuntimeException {
26
27 private Throwable _cause = null;
28
29 /***
30 *
31 */
32 private PlutoAdminException() {
33 super();
34 }
35
36 /***
37 * @param message
38 */
39 public PlutoAdminException(String message) {
40 super(message);
41 }
42
43 /***
44 * @param cause
45 */
46 public PlutoAdminException(Throwable cause) {
47 super(cause.getMessage());
48 _cause = cause;
49 }
50
51 /***
52 * @param message
53 * @param cause
54 */
55 public PlutoAdminException(String message, Throwable cause) {
56 super(message);
57 _cause = cause;
58 }
59
60 /***
61 * @return Returns the cause.
62 */
63 public Throwable getCause() {
64 return _cause;
65 }
66 public String toString() {
67 StringBuffer msg = new StringBuffer();
68 msg.append(getMessage());
69 if (_cause != null) {
70 msg.append(" Underlying cause: ");
71 msg.append(_cause.getClass().getName());
72 msg.append(". Underlying cause message: ");
73 msg.append(_cause.getMessage());
74 }
75 return msg.toString();
76 }
77 }