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 |
50
| public MessagingException(String message) {
|
32 |
50
| super(message);
|
33 |
| } |
34 |
| |
35 |
1
| public MessagingException(String message, Exception cause) {
|
36 |
1
| super(message, cause);
|
37 |
1
| next = cause;
|
38 |
| } |
39 |
| |
40 |
10
| public Exception getNextException() {
|
41 |
10
| 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 |
6
| public String getMessage() {
|
57 |
6
| Exception next = getNextException();
|
58 |
6
| if (next == null) {
|
59 |
3
| return super.getMessage();
|
60 |
| } else { |
61 |
3
| return super.getMessage()
|
62 |
| + " (" |
63 |
| + next.getClass().getName() |
64 |
| + ": " |
65 |
| + next.getMessage() |
66 |
| + ")"; |
67 |
| } |
68 |
| } |
69 |
| } |