01: /**
02: * Copyright 2003-2007 Luck Consulting Pty Ltd
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */package net.sf.ehcache;
16:
17: /**
18: * A runtime Cache Exception.
19: * <p/>
20: * These exceptions may be handled by a <code>CacheExceptionHandler</code> registered with a Cache.
21: * The handler provides a key if it is available. A convention that should be followed in exception messages is
22: * to include in the message "key keyValue" e.g. "key 1234" so that keys can be parsed out of exception messages.
23: *
24: * @author Greg Luck
25: * @version $Id: CacheException.java 525 2007-07-31 22:41:54Z gregluck $
26: */
27: public class CacheException extends RuntimeException {
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: * Constructs a new CacheException with the specified detail message and
46: * cause. <p>Note that the detail message associated with
47: * <code>cause</code> is <i>not</i> automatically incorporated in
48: * this runtime exception's detail message.
49: *
50: * @param message the detail message (which is saved for later retrieval
51: * by the {@link #getMessage()} method).
52: * @param cause the cause (which is saved for later retrieval by the
53: * {@link #getCause()} method). (A <tt>null</tt> value is
54: * permitted, and indicates that the cause is nonexistent or
55: * unknown.)
56: * @since 1.2.4
57: */
58: public CacheException(String message, Throwable cause) {
59: super (message, cause);
60: }
61:
62: /** Constructs a new CacheException with the specified cause and a
63: * detail message of <tt>(cause==null ? null : cause.toString())</tt>
64: * (which typically contains the class and detail message of
65: * <tt>cause</tt>). This constructor is useful for runtime exceptions
66: * that are little more than wrappers for other throwables.
67: *
68: * @param cause the cause (which is saved for later retrieval by the
69: * {@link #getCause()} method). (A <tt>null</tt> value is
70: * permitted, and indicates that the cause is nonexistent or
71: * unknown.)
72: * @since 1.2.4
73: */
74: public CacheException(Throwable cause) {
75: super (cause);
76: }
77:
78: /**
79: * The initial cause of this Exception.
80: * This method is kept for backward compatibility with earlier versions of ehcache which
81: * had its own chained exceptions mechanism, in case any clients out there are using it.
82: * @return the cause or null if this exception has no deeper cause.
83: * @deprecated use getCause instead
84: */
85: public final Throwable getInitialCause() {
86: return super.getCause();
87: }
88:
89: }
|