001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.commons.dbcp;
019:
020: /**
021: * <p>Subclass of <code>RuntimeException</code> that can be used to wrap
022: * a <code>SQLException</code> using the "root cause" pattern of JDK 1.4
023: * exceptions, but without requiring a 1.4 runtime environment.</p>
024: *
025: * @author Jonathan Fuerth
026: * @author Dan Fraser
027: * @version $Revision: 479137 $ $Date: 2006-11-25 08:51:48 -0700 (Sat, 25 Nov 2006) $
028: *
029: * @deprecated This will be removed in a future version of DBCP.
030: **/
031: public class DbcpException extends RuntimeException {
032:
033: // ----------------------------------------------------------- Constructors
034:
035: /**
036: * Construct a new runtime exception with <code>null</code> as its
037: * detail message.
038: */
039: public DbcpException() {
040:
041: super ();
042:
043: }
044:
045: /**
046: * Construct a new runtime exception with the specified detail message.
047: *
048: * @param message The detail message for this exception
049: */
050: public DbcpException(String message) {
051:
052: this (message, null);
053:
054: }
055:
056: /**
057: * Construct a new runtime exception with the specified detail message
058: * and cause.
059: *
060: * @param message The detail message for this exception
061: * @param cause The root cause for this exception
062: */
063: public DbcpException(String message, Throwable cause) {
064:
065: super (message);
066: this .cause = cause;
067:
068: }
069:
070: /**
071: * Construct a new runtime exception with the specified cause and a
072: * detail message of <code>(cause == null ? null : cause.toString())</code>.
073: *
074: * @param cause The root cause for this exception
075: */
076: public DbcpException(Throwable cause) {
077:
078: super ((cause == null) ? (String) null : cause.toString());
079: this .cause = cause;
080:
081: }
082:
083: // ----------------------------------------------------- Instance Variables
084:
085: /**
086: * The root cause of this exception (typically an
087: * <code>SQLException</code> but this is not required).
088: */
089: protected Throwable cause = null;
090:
091: // --------------------------------------------------------- Public Methods
092:
093: /**
094: * Return the root cause of this exception (if any).
095: */
096: public Throwable getCause() {
097:
098: return (this.cause);
099:
100: }
101:
102: }
|