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.1 2004/10/14 18:30:53 minchau Exp $
18: */
19: package org.apache.xml.serializer.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: * This class is a copy of the one in org.apache.xml.utils.
27: * It exists to cut the serializers dependancy on that package.
28: *
29: * This class is not a public API, it is only public because it is
30: * used by org.apache.xml.serializer.
31: * @xsl.usage internal
32: */
33: public final class WrappedRuntimeException extends RuntimeException {
34: static final long serialVersionUID = 7140414456714658073L;
35:
36: /** Primary checked exception.
37: * @serial */
38: private Exception m_exception;
39:
40: /**
41: * Construct a WrappedRuntimeException from a
42: * checked exception.
43: *
44: * @param e Primary checked exception
45: */
46: public WrappedRuntimeException(Exception e) {
47:
48: super (e.getMessage());
49:
50: m_exception = e;
51: }
52:
53: /**
54: * Constructor WrappedRuntimeException
55: *
56: *
57: * @param msg Exception information.
58: * @param e Primary checked exception
59: */
60: public WrappedRuntimeException(String msg, Exception e) {
61:
62: super (msg);
63:
64: m_exception = e;
65: }
66:
67: /**
68: * Get the checked exception that this runtime exception wraps.
69: *
70: * @return The primary checked exception
71: */
72: public Exception getException() {
73: return m_exception;
74: }
75: }
|