KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > dbcp > DbcpException


1 /*
2  * Copyright 1999-2004 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
17 package org.apache.commons.dbcp;
18
19
20 /**
21  * <p>Subclass of <code>RuntimeException</code> that can be used to wrap
22  * a <code>SQLException</code> using the "root cause" pattern of JDK 1.4
23  * exceptions, but without requiring a 1.4 runtime environment.</p>
24  *
25  * @author Jonathan Fuerth
26  * @author Dan Fraser
27  * @version $Revision: 1.5 $ $Date: 2004/02/28 11:48:04 $
28  *
29  * @deprecated This will be removed in a future version of DBCP.
30  **/

31 public class DbcpException extends RuntimeException JavaDoc {
32
33
34     // ----------------------------------------------------------- Constructors
35

36
37     /**
38      * Construct a new runtime exception with <code>null</code> as its
39      * detail message.
40      */

41     public DbcpException() {
42
43         super();
44
45     }
46
47
48     /**
49      * Construct a new runtime exception with the specified detail message.
50      *
51      * @param message The detail message for this exception
52      */

53     public DbcpException(String JavaDoc message) {
54
55         this(message, null);
56
57     }
58
59
60     /**
61      * Construct a new runtime exception with the specified detail message
62      * and cause.
63      *
64      * @param message The detail message for this exception
65      * @param cause The root cause for this exception
66      */

67     public DbcpException(String JavaDoc message, Throwable JavaDoc cause) {
68
69         super(message);
70         this.cause = cause;
71
72     }
73
74
75     /**
76      * Construct a new runtime exception with the specified cause and a
77      * detail message of <code>(cause == null ? null : cause.toString())</code>.
78      *
79      * @param cause The root cause for this exception
80      */

81     public DbcpException(Throwable JavaDoc cause) {
82
83         super((cause == null) ? (String JavaDoc) null : cause.toString());
84         this.cause = cause;
85
86     }
87
88
89     // ----------------------------------------------------- Instance Variables
90

91
92     /**
93      * The root cause of this exception (typically an
94      * <code>SQLException</code> but this is not required).
95      */

96     protected Throwable JavaDoc cause = null;
97
98
99     // --------------------------------------------------------- Public Methods
100

101
102     /**
103      * Return the root cause of this exception (if any).
104      */

105     public Throwable JavaDoc getCause() {
106
107         return (this.cause);
108
109     }
110
111
112 }
113
Popular Tags