01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
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: */
16: /*
17: * $Id: WrappedRuntimeException.java,v 1.7 2004/08/17 18:57:22 jycli Exp $
18: */
19: package org.apache.xml.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 {
27: static final long serialVersionUID = 7140414456714658073L;
28:
29: /** Primary checked exception.
30: * @serial */
31: private Exception 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 e) {
40:
41: super (e.getMessage());
42:
43: m_exception = e;
44: }
45:
46: /**
47: * Constructor WrappedRuntimeException
48: *
49: *
50: * @param msg Exception information.
51: * @param e Primary checked exception
52: */
53: public WrappedRuntimeException(String msg, Exception e) {
54:
55: super (msg);
56:
57: m_exception = e;
58: }
59:
60: /**
61: * Get the checked exception that this runtime exception wraps.
62: *
63: * @return The primary checked exception
64: */
65: public Exception getException() {
66: return m_exception;
67: }
68: }
|