1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.jms; |
8 | |
|
9 | |
import org.mule.api.config.ExceptionReader; |
10 | |
|
11 | |
import java.util.HashMap; |
12 | |
import java.util.Map; |
13 | |
|
14 | |
import javax.jms.JMSException; |
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | 0 | public class JmsExceptionReader implements ExceptionReader |
21 | |
{ |
22 | |
|
23 | |
public String getMessage(Throwable t) |
24 | |
{ |
25 | 0 | JMSException e = (JMSException)t; |
26 | 0 | return e.getMessage() + "(JMS Code: " + e.getErrorCode() + ")"; |
27 | |
} |
28 | |
|
29 | |
public Throwable getCause(Throwable t) |
30 | |
{ |
31 | 0 | JMSException e = (JMSException)t; |
32 | 0 | Throwable cause = e.getLinkedException(); |
33 | 0 | if (cause == null) |
34 | |
{ |
35 | 0 | cause = e.getCause(); |
36 | |
} |
37 | 0 | return cause; |
38 | |
} |
39 | |
|
40 | |
public Class<?> getExceptionType() |
41 | |
{ |
42 | 0 | return JMSException.class; |
43 | |
} |
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public Map<?, ?> getInfo(Throwable t) |
51 | |
{ |
52 | 0 | JMSException e = (JMSException)t; |
53 | 0 | Map<String, Object> info = new HashMap<String, Object>(); |
54 | 0 | info.put("JMS Code", e.getErrorCode()); |
55 | 0 | return info; |
56 | |
} |
57 | |
|
58 | |
} |