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.Iterator;
17 import java.util.Map;
18
19 import org.apache.axis.AxisFault;
20
21
22
23
24
25 public class AxisFaultExceptionReader implements ExceptionReader
26 {
27
28 public String getMessage(Throwable t)
29 {
30 AxisFault e = (AxisFault)t;
31 Map props = getInfo(e);
32 StringBuffer msg = new StringBuffer(64);
33 msg.append("(");
34 for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();)
35 {
36 Map.Entry entry = (Map.Entry)iterator.next();
37 msg.append(entry.getKey()).append(": ").append(entry.getValue()).append(", ");
38 }
39 msg.append(")");
40 return e.getMessage() + msg.toString();
41 }
42
43 public Throwable getCause(Throwable t)
44 {
45 AxisFault e = (AxisFault)t;
46 Throwable cause = e.detail;
47 if (cause == null)
48 {
49 cause = e.getCause();
50 }
51 return cause;
52 }
53
54 public Class getExceptionType()
55 {
56 return AxisFault.class;
57 }
58
59
60
61
62
63
64 public Map getInfo(Throwable t)
65 {
66 AxisFault e = (AxisFault)t;
67 Map info = new HashMap();
68 info.put("Fault", e.getFaultString());
69 info.put("Fault Code", e.getFaultCode().toString());
70 info.put("Fault Actor", e.getFaultActor());
71 info.put("Fault Node", e.getFaultNode());
72 info.put("Fault Reason", e.getFaultReason());
73 info.put("Fault Role", e.getFaultRole());
74 info.put("Fault Dump", e.dumpToString());
75
76
77 return info;
78 }
79 }