KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portlet > admin > PlutoAdminException


1 /*
2  * Copyright 2003,2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.pluto.portlet.admin;
17
18 /**
19  * The main application exception that is a RuntimeException and
20  * can wrap an underlying exception (i.e. the cause).
21  *
22  * @author Craig Doremus
23  *
24  */

25 public class PlutoAdminException extends RuntimeException JavaDoc {
26
27     private Throwable JavaDoc _cause = null;
28
29     /**
30      *
31      */

32     private PlutoAdminException() {
33         super();
34     }
35
36     /**
37      * @param message
38      */

39     public PlutoAdminException(String JavaDoc message) {
40         super(message);
41     }
42
43     /**
44      * @param cause
45      */

46     public PlutoAdminException(Throwable JavaDoc cause) {
47         super(cause.getMessage());
48         _cause = cause;
49     }
50
51     /**
52      * @param message
53      * @param cause
54      */

55     public PlutoAdminException(String JavaDoc message, Throwable JavaDoc cause) {
56         super(message);
57         _cause = cause;
58     }
59
60     /**
61      * @return Returns the cause.
62      */

63     public Throwable JavaDoc getCause() {
64         return _cause;
65     }
66     public String JavaDoc toString() {
67         StringBuffer JavaDoc msg = new StringBuffer JavaDoc();
68         msg.append(getMessage());
69         if (_cause != null) {
70             msg.append(" Underlying cause: ");
71             msg.append(_cause.getClass().getName());
72             msg.append(". Underlying cause message: ");
73             msg.append(_cause.getMessage());
74         }
75         return msg.toString();
76     }
77 }
78
Popular Tags