View Javadoc

1   /*
2   Silly exceptions - A library of funny sounding, but useful Java Exceptions.
3   Copyright (C) 2004  W.H. Schraal, sillyexceptions.sf.net
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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  }