1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.impl.message; |
12 | |
|
13 | |
import org.mule.config.ExceptionHelper; |
14 | |
import org.mule.umo.UMOException; |
15 | |
import org.mule.umo.UMOExceptionPayload; |
16 | |
|
17 | |
import java.util.Map; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
public class ExceptionPayload implements UMOExceptionPayload |
24 | |
{ |
25 | |
|
26 | |
|
27 | |
|
28 | |
private static final long serialVersionUID = -7114836033686599024L; |
29 | |
|
30 | 0 | private int code = 0; |
31 | 0 | private String message = null; |
32 | 0 | private Map info = null; |
33 | |
private Throwable exception; |
34 | |
|
35 | |
public ExceptionPayload(Throwable exception) |
36 | 0 | { |
37 | 0 | this.exception = exception; |
38 | 0 | UMOException muleRoot = ExceptionHelper.getRootMuleException(exception); |
39 | 0 | if (muleRoot != null) |
40 | |
{ |
41 | 0 | message = muleRoot.getMessage(); |
42 | 0 | code = muleRoot.getExceptionCode(); |
43 | 0 | info = muleRoot.getInfo(); |
44 | |
} |
45 | |
else |
46 | |
{ |
47 | 0 | message = exception.getMessage(); |
48 | |
} |
49 | 0 | } |
50 | |
|
51 | |
public Throwable getRootException() |
52 | |
{ |
53 | 0 | return ExceptionHelper.getRootException(exception); |
54 | |
} |
55 | |
|
56 | |
public int getCode() |
57 | |
{ |
58 | 0 | return code; |
59 | |
} |
60 | |
|
61 | |
public String getMessage() |
62 | |
{ |
63 | 0 | return message; |
64 | |
} |
65 | |
|
66 | |
public Map getInfo() |
67 | |
{ |
68 | 0 | return info; |
69 | |
} |
70 | |
|
71 | |
public Throwable getException() |
72 | |
{ |
73 | 0 | return exception; |
74 | |
} |
75 | |
|
76 | |
} |