|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package javax.mail; |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| public class MessagingException extends Exception { |
|
24 |
| |
|
25 |
| private Exception next; |
|
26 |
| |
|
27 |
0
| public MessagingException() {
|
|
28 |
0
| super();
|
|
29 |
| } |
|
30 |
| |
|
31 |
51
| public MessagingException(String message) {
|
|
32 |
51
| super(message);
|
|
33 |
| } |
|
34 |
| |
|
35 |
1
| public MessagingException(String message, Exception cause) {
|
|
36 |
1
| super(message, cause);
|
|
37 |
1
| next = cause;
|
|
38 |
| } |
|
39 |
| |
|
40 |
11
| public Exception getNextException() {
|
|
41 |
11
| return next;
|
|
42 |
| } |
|
43 |
| |
|
44 |
7
| public synchronized boolean setNextException(Exception cause) {
|
|
45 |
7
| if (next == null) {
|
|
46 |
4
| initCause(cause);
|
|
47 |
4
| next = cause;
|
|
48 |
4
| return true;
|
|
49 |
3
| } else if (next instanceof MessagingException) {
|
|
50 |
1
| return ((MessagingException) next).setNextException(cause);
|
|
51 |
| } else { |
|
52 |
2
| return false;
|
|
53 |
| } |
|
54 |
| } |
|
55 |
| |
|
56 |
7
| public String getMessage() {
|
|
57 |
7
| Exception next = getNextException();
|
|
58 |
7
| if (next == null) {
|
|
59 |
4
| return super.getMessage();
|
|
60 |
| } else { |
|
61 |
3
| return super.getMessage()
|
|
62 |
| + " (" |
|
63 |
| + next.getClass().getName() |
|
64 |
| + ": " |
|
65 |
| + next.getMessage() |
|
66 |
| + ")"; |
|
67 |
| } |
|
68 |
| } |
|
69 |
| } |