|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.hivemind; |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| public class ApplicationRuntimeException extends RuntimeException implements Locatable |
|
27 |
| { |
|
28 |
| private static final long serialVersionUID = 1L; |
|
29 |
| |
|
30 |
| private Throwable _rootCause; |
|
31 |
| |
|
32 |
| private transient Location _location; |
|
33 |
| |
|
34 |
| private transient Object _component; |
|
35 |
| |
|
36 |
2
| public ApplicationRuntimeException(Throwable rootCause)
|
|
37 |
| { |
|
38 |
2
| this(rootCause.getMessage(), rootCause);
|
|
39 |
| } |
|
40 |
| |
|
41 |
57
| public ApplicationRuntimeException(String message)
|
|
42 |
| { |
|
43 |
57
| this(message, null, null, null);
|
|
44 |
| } |
|
45 |
| |
|
46 |
23
| public ApplicationRuntimeException(String message, Throwable rootCause)
|
|
47 |
| { |
|
48 |
23
| this(message, null, null, rootCause);
|
|
49 |
| } |
|
50 |
| |
|
51 |
124
| public ApplicationRuntimeException(String message, Object component, Location location,
|
|
52 |
| Throwable rootCause) |
|
53 |
| { |
|
54 |
124
| super(message);
|
|
55 |
| |
|
56 |
124
| _rootCause = rootCause;
|
|
57 |
124
| _component = component;
|
|
58 |
| |
|
59 |
124
| _location = HiveMind.findLocation(new Object[]
|
|
60 |
| { location, rootCause, component }); |
|
61 |
| } |
|
62 |
| |
|
63 |
33
| public ApplicationRuntimeException(String message, Location location, Throwable rootCause)
|
|
64 |
| { |
|
65 |
33
| this(message, null, location, rootCause);
|
|
66 |
| } |
|
67 |
| |
|
68 |
7
| public Throwable getRootCause()
|
|
69 |
| { |
|
70 |
7
| return _rootCause;
|
|
71 |
| } |
|
72 |
| |
|
73 |
17
| public Location getLocation()
|
|
74 |
| { |
|
75 |
17
| return _location;
|
|
76 |
| } |
|
77 |
| |
|
78 |
7
| public Object getComponent()
|
|
79 |
| { |
|
80 |
7
| return _component;
|
|
81 |
| } |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
2
| public Throwable getCause()
|
|
89 |
| { |
|
90 |
2
| return _rootCause;
|
|
91 |
| } |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
5
| public String toString()
|
|
101 |
| { |
|
102 |
5
| if (_location == null)
|
|
103 |
4
| return super.toString();
|
|
104 |
| |
|
105 |
1
| StringBuffer buffer = new StringBuffer(super.toString());
|
|
106 |
1
| buffer.append(" [");
|
|
107 |
1
| buffer.append(_location);
|
|
108 |
1
| buffer.append("]");
|
|
109 |
| |
|
110 |
1
| return buffer.toString();
|
|
111 |
| } |
|
112 |
| } |