KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > JBossJMSException


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.jms;
8
9 import javax.jms.JMSException JavaDoc;
10
11 /**
12  * A JMS exception that allows for an embedded exception
13  *
14  * @author <a HREF="mailto:adrian@jboss.org>Adrian Brock</a>
15  * @version $Revision: 1.1 $
16  */

17 public class JBossJMSException
18    extends JMSException JavaDoc
19 {
20    // Constants -----------------------------------------------------
21

22    // Attributes ----------------------------------------------------
23

24    /**
25     * The causing exception
26     */

27    private Throwable JavaDoc cause;
28
29    // Static --------------------------------------------------------
30

31    /**
32     * Handle an exception
33     *
34     * @param t the exception
35     * @return the resultant JMSException
36     */

37    public static JMSException JavaDoc handle(Throwable JavaDoc t)
38    {
39       if (t instanceof JMSException JavaDoc)
40          return (JMSException JavaDoc) t;
41       return new JBossJMSException("Error",t);
42    }
43
44    // Constructors --------------------------------------------------
45

46    /**
47     * Construct a new JBossJMSException with the give message
48     *
49     * @param message the message
50     */

51    public JBossJMSException(String JavaDoc message)
52    {
53       super(message);
54    }
55
56    /**
57     * Construct a new JBossJMSException with the give message and
58     * cause
59     *
60     * @param message the message
61     * @param cause the cause
62     */

63    public JBossJMSException(String JavaDoc message, Throwable JavaDoc cause)
64    {
65       super(message);
66       this.cause = cause;
67    }
68
69    // Public --------------------------------------------------------
70

71    // X implementation ----------------------------------------------
72

73    // Throwable overrides -------------------------------------------
74

75    public Throwable JavaDoc getCause()
76    {
77       return cause;
78    }
79
80    // Protected ------------------------------------------------------
81

82    // Package Private ------------------------------------------------
83

84    // Private --------------------------------------------------------
85

86    // Inner Classes --------------------------------------------------
87
}
88
Popular Tags