KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > JMSException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package javax.jms;
26
27 /**
28  * <P>This is the root class of all JMS API exceptions.
29  *
30  * <P>It provides the following information:
31  * <UL>
32  * <LI> A provider-specific string describing the error. This string is
33  * the standard exception message and is available via the
34  * <CODE>getMessage</CODE> method.
35  * <LI> A provider-specific string error code
36  * <LI> A reference to another exception. Often a JMS API exception will
37  * be the result of a lower-level problem. If appropriate, this
38  * lower-level exception can be linked to the JMS API exception.
39  * </UL>
40  * @version 1.0 - 5 Oct 1998
41  * @author Mark Hapner
42  * @author Rich Burridge
43  **/

44
45 public class JMSException extends Exception JavaDoc {
46
47   /** Vendor-specific error code.
48   **/

49   private String JavaDoc errorCode;
50
51   /** <CODE>Exception</CODE> reference.
52   **/

53   private Exception JavaDoc linkedException;
54
55
56   /** Constructs a <CODE>JMSException</CODE> with the specified reason and
57    * error code.
58    *
59    * @param reason a description of the exception
60    * @param errorCode a string specifying the vendor-specific
61    * error code
62    **/

63   public
64   JMSException(String JavaDoc reason, String JavaDoc errorCode) {
65     super(reason);
66     this.errorCode = errorCode;
67     linkedException = null;
68   }
69
70   /** Constructs a <CODE>JMSException</CODE> with the specified reason and with
71    * the error code defaulting to null.
72    *
73    * @param reason a description of the exception
74    **/

75   public
76   JMSException(String JavaDoc reason) {
77     super(reason);
78     this.errorCode = null;
79     linkedException = null;
80   }
81
82   /** Gets the vendor-specific error code.
83    * @return a string specifying the vendor-specific
84    * error code
85   **/

86   public
87   String JavaDoc getErrorCode() {
88     return this.errorCode;
89   }
90
91   /**
92    * Gets the exception linked to this one.
93    *
94    * @return the linked <CODE>Exception</CODE>, null if none
95   **/

96   public
97   Exception JavaDoc getLinkedException() {
98     return (linkedException);
99   }
100
101   /**
102    * Adds a linked <CODE>Exception</CODE>.
103    *
104    * @param ex the linked <CODE>Exception</CODE>
105   **/

106   public
107   synchronized void setLinkedException(Exception JavaDoc ex) {
108       linkedException = ex;
109   }
110 }
111
Popular Tags