1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.soap.axis;
12
13 import org.mule.api.config.ExceptionReader;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 import org.apache.axis.AxisFault;
19
20
21
22
23
24 public class AxisFaultExceptionReader implements ExceptionReader
25 {
26
27 public String getMessage(Throwable t)
28 {
29 AxisFault e = (AxisFault)t;
30 Map<?, ?> props = getInfo(e);
31 StringBuffer msg = new StringBuffer(64);
32 msg.append("(");
33 for (Map.Entry<?, ?> entry : props.entrySet())
34 {
35 msg.append(entry.getKey()).append(": ").append(entry.getValue()).append(", ");
36 }
37 msg.append(")");
38 return e.getMessage() + msg.toString();
39 }
40
41 public Throwable getCause(Throwable t)
42 {
43 AxisFault e = (AxisFault)t;
44 Throwable cause = e.detail;
45 if (cause == null)
46 {
47 cause = e.getCause();
48 }
49 return cause;
50 }
51
52 public Class<?> getExceptionType()
53 {
54 return AxisFault.class;
55 }
56
57
58
59
60
61
62 public Map<?, ?> getInfo(Throwable t)
63 {
64 AxisFault e = (AxisFault)t;
65 Map<String, Object> info = new HashMap<String, Object>();
66 info.put("Fault", e.getFaultString());
67 info.put("Fault Code", e.getFaultCode().toString());
68 info.put("Fault Actor", e.getFaultActor());
69 info.put("Fault Node", e.getFaultNode());
70 info.put("Fault Reason", e.getFaultReason());
71 info.put("Fault Role", e.getFaultRole());
72 info.put("Fault Dump", e.dumpToString());
73
74
75 return info;
76 }
77 }