1 /**
2 * Copyright 2003-2007 Greg Luck
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
18 package net.sf.ehcache;
19
20 /**
21 * A runtime Cache Exception
22 *
23 * @author Greg Luck
24 * @version $Id: CacheException.java 512 2007-07-10 09:18:45Z gregluck $
25 */
26 public class CacheException extends RuntimeException {
27
28
29 /**
30 * Constructor for the CacheException object.
31 */
32 public CacheException() {
33 super();
34 }
35
36 /**
37 * Constructor for the CacheException object.
38 * @param message the exception detail message
39 */
40 public CacheException(String message) {
41 super(message);
42 }
43
44
45
46 /**
47 * Constructs a new CacheException with the specified detail message and
48 * cause. <p>Note that the detail message associated with
49 * <code>cause</code> is <i>not</i> automatically incorporated in
50 * this runtime exception's detail message.
51 *
52 * @param message the detail message (which is saved for later retrieval
53 * by the {@link #getMessage()} method).
54 * @param cause the cause (which is saved for later retrieval by the
55 * {@link #getCause()} method). (A <tt>null</tt> value is
56 * permitted, and indicates that the cause is nonexistent or
57 * unknown.)
58 * @since 1.2.4
59 */
60 public CacheException(String message, Throwable cause) {
61 super(message, cause);
62 }
63
64 /** Constructs a new CacheException with the specified cause and a
65 * detail message of <tt>(cause==null ? null : cause.toString())</tt>
66 * (which typically contains the class and detail message of
67 * <tt>cause</tt>). This constructor is useful for runtime exceptions
68 * that are little more than wrappers for other throwables.
69 *
70 * @param cause the cause (which is saved for later retrieval by the
71 * {@link #getCause()} method). (A <tt>null</tt> value is
72 * permitted, and indicates that the cause is nonexistent or
73 * unknown.)
74 * @since 1.2.4
75 */
76 public CacheException(Throwable cause) {
77 super(cause);
78 }
79
80
81 /**
82 * The initial cause of this Exception.
83 * This method is kept for backward compatibility with earlier versions of ehcache which
84 * had its own chained exceptions mechanism, in case any clients out there are using it.
85 * @return the cause or null if this exception has no deeper cause.
86 * @deprecated use getCause instead
87 */
88 public final Throwable getInitialCause() {
89 return super.getCause();
90 }
91
92
93
94
95 }