| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DbcpException |
|
| 1.2;1.2 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | ||
| 18 | package org.apache.commons.dbcp; | |
| 19 | ||
| 20 | ||
| 21 | /** | |
| 22 | * <p>Subclass of <code>RuntimeException</code> that can be used to wrap | |
| 23 | * a <code>SQLException</code> using the "root cause" pattern of JDK 1.4 | |
| 24 | * exceptions, but without requiring a 1.4 runtime environment.</p> | |
| 25 | * | |
| 26 | * @author Jonathan Fuerth | |
| 27 | * @author Dan Fraser | |
| 28 | * @version $Revision: 1023401 $ $Date: 2010-10-16 21:54:24 -0400 (Sat, 16 Oct 2010) $ | |
| 29 | * | |
| 30 | * @deprecated This will be removed in a future version of DBCP. | |
| 31 | **/ | |
| 32 | public class DbcpException extends RuntimeException { | |
| 33 | ||
| 34 | private static final long serialVersionUID = 2477800549022838103L; | |
| 35 | ||
| 36 | // ----------------------------------------------------------- Constructors | |
| 37 | ||
| 38 | ||
| 39 | /** | |
| 40 | * Construct a new runtime exception with <code>null</code> as its | |
| 41 | * detail message. | |
| 42 | */ | |
| 43 | public DbcpException() { | |
| 44 | ||
| 45 | 0 | super(); |
| 46 | ||
| 47 | 0 | } |
| 48 | ||
| 49 | ||
| 50 | /** | |
| 51 | * Construct a new runtime exception with the specified detail message. | |
| 52 | * | |
| 53 | * @param message The detail message for this exception | |
| 54 | */ | |
| 55 | public DbcpException(String message) { | |
| 56 | ||
| 57 | 0 | this(message, null); |
| 58 | ||
| 59 | 0 | } |
| 60 | ||
| 61 | ||
| 62 | /** | |
| 63 | * Construct a new runtime exception with the specified detail message | |
| 64 | * and cause. | |
| 65 | * | |
| 66 | * @param message The detail message for this exception | |
| 67 | * @param cause The root cause for this exception | |
| 68 | */ | |
| 69 | public DbcpException(String message, Throwable cause) { | |
| 70 | ||
| 71 | 0 | super(message); |
| 72 | 0 | this.cause = cause; |
| 73 | ||
| 74 | 0 | } |
| 75 | ||
| 76 | ||
| 77 | /** | |
| 78 | * Construct a new runtime exception with the specified cause and a | |
| 79 | * detail message of <code>(cause == null ? null : cause.toString())</code>. | |
| 80 | * | |
| 81 | * @param cause The root cause for this exception | |
| 82 | */ | |
| 83 | public DbcpException(Throwable cause) { | |
| 84 | ||
| 85 | 0 | super((cause == null) ? (String) null : cause.toString()); |
| 86 | 0 | this.cause = cause; |
| 87 | ||
| 88 | 0 | } |
| 89 | ||
| 90 | ||
| 91 | // ----------------------------------------------------- Instance Variables | |
| 92 | ||
| 93 | ||
| 94 | /** | |
| 95 | * The root cause of this exception (typically an | |
| 96 | * <code>SQLException</code> but this is not required). | |
| 97 | */ | |
| 98 | 0 | protected Throwable cause = null; |
| 99 | ||
| 100 | ||
| 101 | // --------------------------------------------------------- Public Methods | |
| 102 | ||
| 103 | ||
| 104 | /** | |
| 105 | * Return the root cause of this exception (if any). | |
| 106 | */ | |
| 107 | public Throwable getCause() { | |
| 108 | ||
| 109 | 0 | return (this.cause); |
| 110 | ||
| 111 | } | |
| 112 | ||
| 113 | ||
| 114 | } |