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