KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > utils > WrappedRuntimeException


1 /*
2  * Copyright 1999-2004 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 /*
17  * $Id: WrappedRuntimeException.java,v 1.6 2004/02/17 04:21:14 minchau Exp $
18  */

19 package com.sun.org.apache.xml.internal.utils;
20
21 /**
22  * This class is for throwing important checked exceptions
23  * over non-checked methods. It should be used with care,
24  * and in limited circumstances.
25  */

26 public class WrappedRuntimeException extends RuntimeException JavaDoc
27 {
28
29   /** Primary checked exception.
30    * @serial */

31   private Exception JavaDoc m_exception;
32
33   /**
34    * Construct a WrappedRuntimeException from a
35    * checked exception.
36    *
37    * @param e Primary checked exception
38    */

39   public WrappedRuntimeException(Exception JavaDoc e)
40   {
41
42     super(e.getMessage());
43
44     m_exception = e;
45   }
46
47   /**
48    * Constructor WrappedRuntimeException
49    *
50    *
51    * @param msg Exception information.
52    * @param e Primary checked exception
53    */

54   public WrappedRuntimeException(String JavaDoc msg, Exception JavaDoc e)
55   {
56
57     super(msg);
58
59     m_exception = e;
60   }
61   
62   /**
63    * Get the checked exception that this runtime exception wraps.
64    *
65    * @return The primary checked exception
66    */

67   public Exception JavaDoc getException()
68   {
69     return m_exception;
70   }
71 }
72
Popular Tags