KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > lang > UnhandledException


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
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 package org.apache.commons.lang;
17
18 import org.apache.commons.lang.exception.NestableRuntimeException;
19
20 /**
21  * <p>Thrown when it is impossible or undesirable to consume or throw a checked exception.</p>
22  * This exception supplements the standard exception classes by providing a more
23  * semantically rich description of the problem.</p>
24  *
25  * <p><code>UnhandledException</code> represents the case where a method has to deal
26  * with a checked exception but does not wish to.
27  * Instead, the checked exception is rethrown in this unchecked wrapper.</p>
28  *
29  * <pre>
30  * public void foo() {
31  * try {
32  * // do something that throws IOException
33  * } catch (IOException ex) {
34  * // don't want to or can't throw IOException from foo()
35  * throw new UnhandledException(ex);
36  * }
37  * }
38  * </pre>
39  *
40  * @author Matthew Hawthorne
41  * @since 2.0
42  * @version $Id: UnhandledException.java 161243 2005-04-14 04:30:28Z ggregory $
43  */

44 public class UnhandledException extends NestableRuntimeException {
45
46     /**
47      * Constructs the exception using a cause.
48      *
49      * @param cause the underlying cause
50      */

51     public UnhandledException(Throwable JavaDoc cause) {
52         super(cause);
53     }
54
55     /**
56      * Constructs the exception using a message and cause.
57      *
58      * @param message the message to use
59      * @param cause the underlying cause
60      */

61     public UnhandledException(String JavaDoc message, Throwable JavaDoc cause) {
62         super(message, cause);
63     }
64
65 }
66
Popular Tags