1 /**
2 * Copyright Terracotta, Inc.
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 * <p/>
23 * These exceptions may be handled by a <code>CacheExceptionHandler</code> registered with a Cache.
24 * The handler provides a key if it is available. A convention that should be followed in exception messages is
25 * to include in the message "key keyValue" e.g. "key 1234" so that keys can be parsed out of exception messages.
26 * <p/>
27 * Updated in version 1.5 to remove <code>getInitialCause</code> which was a left over from the pre-JDK1.4
28 * days. It breaks JAXB.
29 *
30 * @author Greg Luck
31 * @version $Id: CacheException.java 5631 2012-05-10 08:31:33Z teck $
32 *
33 */
34 public class CacheException extends RuntimeException {
35
36
37 private static final long serialVersionUID = 142468800110101833L;
38
39
40 /**
41 * Constructor for the CacheException object.
42 */
43 public CacheException() {
44 super();
45 }
46
47 /**
48 * Constructor for the CacheException object.
49 * @param message the exception detail message
50 */
51 public CacheException(String message) {
52 super(message);
53 }
54
55
56
57 /**
58 * Constructs a new CacheException with the specified detail message and
59 * cause. <p>Note that the detail message associated with
60 * <code>cause</code> is <i>not</i> automatically incorporated in
61 * this runtime exception's detail message.
62 *
63 * @param message the detail message (which is saved for later retrieval
64 * by the {@link #getMessage()} method).
65 * @param cause the cause (which is saved for later retrieval by the
66 * {@link #getCause()} method). (A <tt>null</tt> value is
67 * permitted, and indicates that the cause is nonexistent or
68 * unknown.)
69 * @since 1.2.4
70 */
71 public CacheException(String message, Throwable cause) {
72 super(message, cause);
73 }
74
75 /** Constructs a new CacheException with the specified cause and a
76 * detail message of <tt>(cause==null ? null : cause.toString())</tt>
77 * (which typically contains the class and detail message of
78 * <tt>cause</tt>). This constructor is useful for runtime exceptions
79 * that are little more than wrappers for other throwables.
80 *
81 * @param cause the cause (which is saved for later retrieval by the
82 * {@link #getCause()} method). (A <tt>null</tt> value is
83 * permitted, and indicates that the cause is nonexistent or
84 * unknown.)
85 * @since 1.2.4
86 */
87 public CacheException(Throwable cause) {
88 super(cause);
89 }
90
91 }
92