01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.xerces.xni;
19:
20: /**
21: * This exception is the base exception of all XNI exceptions. It
22: * can be constructed with an error message or used to wrap another
23: * exception object.
24: * <p>
25: * <strong>Note:</strong> By extending the Java
26: * <code>RuntimeException</code>, XNI handlers and components are
27: * not required to catch XNI exceptions but may explicitly catch
28: * them, if so desired.
29: *
30: * @author Andy Clark, IBM
31: *
32: * @version $Id: XNIException.java 447247 2006-09-18 05:23:52Z mrglavas $
33: */
34: public class XNIException extends RuntimeException {
35:
36: /** Serialization version. */
37: static final long serialVersionUID = 9019819772686063775L;
38:
39: //
40: // Data
41: //
42:
43: /** The wrapped exception. */
44: private Exception fException;
45:
46: //
47: // Constructors
48: //
49:
50: /**
51: * Constructs an XNI exception with a message.
52: *
53: * @param message The exception message.
54: */
55: public XNIException(String message) {
56: super (message);
57: } // <init>(String)
58:
59: /**
60: * Constructs an XNI exception with a wrapped exception.
61: *
62: * @param exception The wrapped exception.
63: */
64: public XNIException(Exception exception) {
65: super (exception.getMessage());
66: fException = exception;
67: } // <init>(Exception)
68:
69: /**
70: * Constructs an XNI exception with a message and wrapped exception.
71: *
72: * @param message The exception message.
73: * @param exception The wrapped exception.
74: */
75: public XNIException(String message, Exception exception) {
76: super (message);
77: fException = exception;
78: } // <init>(Exception,String)
79:
80: //
81: // Public methods
82: //
83:
84: /** Returns the wrapped exception. */
85: public Exception getException() {
86: return fException;
87: } // getException():Exception
88:
89: } // class QName
|