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 private int code = 0;
31 private String message = null;
32 private Map info = null;
33 private Throwable exception;
34
35 public ExceptionPayload(Throwable exception)
36 {
37 this.exception = exception;
38 UMOException muleRoot = ExceptionHelper.getRootMuleException(exception);
39 if (muleRoot != null)
40 {
41 message = muleRoot.getMessage();
42 code = muleRoot.getExceptionCode();
43 info = muleRoot.getInfo();
44 }
45 else
46 {
47 message = exception.getMessage();
48 }
49 }
50
51 public Throwable getRootException()
52 {
53 return ExceptionHelper.getRootException(exception);
54 }
55
56 public int getCode()
57 {
58 return code;
59 }
60
61 public String getMessage()
62 {
63 return message;
64 }
65
66 public Map getInfo()
67 {
68 return info;
69 }
70
71 public Throwable getException()
72 {
73 return exception;
74 }
75
76 }