KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > common > exception > JMSAdminException


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 package com.sun.enterprise.admin.common.exception;
25
26 /**
27  */

28 public class JMSAdminException extends AFException
29 {
30
31     /**
32      * Exception reference
33      **/

34     private Exception JavaDoc linkedException;
35     private String JavaDoc _message = null;
36
37     /**
38      * Constructs an JMSAdminException object
39      */

40     public JMSAdminException()
41     {
42         super();
43         linkedException = null;
44     }
45
46     /**
47      * Constructs an JMSAdminException object
48      * @param message Exception message
49      */

50     public JMSAdminException(String JavaDoc message)
51     {
52         super(message);
53     _message = message;
54         linkedException = null;
55     }
56
57     /**
58      * Gets the exception linked to this one
59      *
60      * @return the linked Exception, null if none
61      **/

62     public Exception JavaDoc getLinkedException() {
63         return (linkedException);
64     }
65
66     /**
67      * Adds a linked Exception
68      *
69      * @param ex the linked Exception
70      **/

71     public synchronized void setLinkedException(Exception JavaDoc ex) {
72         linkedException = ex;
73     }
74
75     /**
76      * Returns the message along with the message from any linked exception.
77      *
78      **/

79     public String JavaDoc getMessage() {
80     String JavaDoc retString = null;
81
82     // Return the message of this exception.
83
if (_message != null) {
84        retString = _message;
85     }
86
87     // Append any message from the linked exception.
88
if (linkedException != null && linkedException.getMessage() != null) {
89         if (retString != null) {
90             retString += retString + "\n" + linkedException.getMessage();
91         } else {
92             retString = linkedException.getMessage();
93         }
94     }
95
96     return retString;
97         
98     }
99
100 }
101
Popular Tags