1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.sillyexceptions;
20
21 /***
22 * This exception should be used at places where you don't expect an exceptional
23 * situation to occur.
24 * <p>
25 * For example, sometimes you <b>have</b> to catch an exception (because an API
26 * demands it), while you are absolutely sure that the exception will never
27 * occur. In that case you can better:
28 * <pre>
29 * throw new OutOfTheBlueException("Properties could not be loaded, although they are always there.");
30 * </pre>
31 * instead of:
32 * <pre>
33 * //This can never happen, since the properties are always there.
34 * </pre>
35 *
36 * @author W.H. Schraal
37 * @version $Id: OutOfTheBlueException.java,v 1.3 2004/09/06 16:53:22 hippe Exp $
38 * @since 1.0
39 */
40 public class OutOfTheBlueException extends RuntimeException {
41
42 /***
43 * Constructs a new OutOfTheBlueException with the specified detail message.
44 * The cause is not initialized, and may subsequently be initialized by a
45 * call to {@link #initCause}.
46 *
47 * @param message the detail message. The detail message is saved for
48 * later retrieval by the {@link #getMessage()} method.
49 */
50 public OutOfTheBlueException(String message) {
51 super(message);
52 }
53
54 /***
55 * Constructs a new OutOfTheBlueException with the specified detail message
56 * and cause. <p>Note that the detail message associated with
57 * <code>cause</code> is <i>not</i> automatically incorporated in
58 * this exception's detail message.
59 *
60 * @param message the detail message (which is saved for later retrieval
61 * by the {@link #getMessage()} method).
62 * @param cause the cause (which is saved for later retrieval by the
63 * {@link #getCause()} method). (A <tt>null</tt> value is
64 * permitted, and indicates that the cause is nonexistent or
65 * unknown.)
66 */
67 public OutOfTheBlueException(String message, Throwable cause) {
68 super(message, cause);
69 }
70
71 /***
72 * Constructs a new OutOfTheBlueException with the specified cause and a
73 * detail message of <tt>(cause==null ? null : cause.toString())</tt>
74 * (which typically contains the class and detail message of
75 * <tt>cause</tt>). This constructor is useful for exceptions
76 * that are little more than wrappers for other throwables.
77 *
78 * @param cause the cause (which is saved for later retrieval by the
79 * {@link #getCause()} method). (A <tt>null</tt> value is
80 * permitted, and indicates that the cause is nonexistent or
81 * unknown.)
82 */
83 public OutOfTheBlueException(Throwable cause) {
84 super(cause);
85 }
86
87 }