12005
|
1 |
/*
|
|
2 |
* reserved comment block
|
|
3 |
* DO NOT REMOVE OR ALTER!
|
|
4 |
*/
|
|
5 |
/*
|
|
6 |
* Copyright 2001, 2002,2004 The Apache Software Foundation.
|
|
7 |
*
|
|
8 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9 |
* you may not use this file except in compliance with the License.
|
|
10 |
* You may obtain a copy of the License at
|
|
11 |
*
|
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13 |
*
|
|
14 |
* Unless required by applicable law or agreed to in writing, software
|
|
15 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17 |
* See the License for the specific language governing permissions and
|
|
18 |
* limitations under the License.
|
|
19 |
*/
|
|
20 |
|
|
21 |
package com.sun.org.apache.xerces.internal.xni;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* This exception is the base exception of all XNI exceptions. It
|
|
25 |
* can be constructed with an error message or used to wrap another
|
|
26 |
* exception object.
|
|
27 |
* <p>
|
|
28 |
* <strong>Note:</strong> By extending the Java
|
|
29 |
* <code>RuntimeException</code>, XNI handlers and components are
|
|
30 |
* not required to catch XNI exceptions but may explicitly catch
|
|
31 |
* them, if so desired.
|
|
32 |
*
|
|
33 |
* @author Andy Clark, IBM
|
|
34 |
*
|
|
35 |
*/
|
|
36 |
public class XNIException
|
|
37 |
extends RuntimeException {
|
|
38 |
|
|
39 |
/** Serialization version. */
|
|
40 |
static final long serialVersionUID = 9019819772686063775L;
|
|
41 |
|
|
42 |
//
|
|
43 |
// Data
|
|
44 |
//
|
|
45 |
|
|
46 |
/** The wrapped exception. */
|
|
47 |
private Exception fException;
|
|
48 |
|
|
49 |
//
|
|
50 |
// Constructors
|
|
51 |
//
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Constructs an XNI exception with a message.
|
|
55 |
*
|
|
56 |
* @param message The exception message.
|
|
57 |
*/
|
|
58 |
public XNIException(String message) {
|
|
59 |
super(message);
|
|
60 |
} // <init>(String)
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Constructs an XNI exception with a wrapped exception.
|
|
64 |
*
|
|
65 |
* @param exception The wrapped exception.
|
|
66 |
*/
|
|
67 |
public XNIException(Exception exception) {
|
|
68 |
super(exception.getMessage());
|
|
69 |
fException = exception;
|
|
70 |
} // <init>(Exception)
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Constructs an XNI exception with a message and wrapped exception.
|
|
74 |
*
|
|
75 |
* @param message The exception message.
|
|
76 |
* @param exception The wrapped exception.
|
|
77 |
*/
|
|
78 |
public XNIException(String message, Exception exception) {
|
|
79 |
super(message);
|
|
80 |
fException = exception;
|
|
81 |
} // <init>(Exception,String)
|
|
82 |
|
|
83 |
//
|
|
84 |
// Public methods
|
|
85 |
//
|
|
86 |
|
|
87 |
/** Returns the wrapped exception. */
|
|
88 |
public Exception getException() {
|
|
89 |
return fException;
|
|
90 |
} // getException():Exception
|
|
91 |
|
|
92 |
public Throwable getCause() {
|
|
93 |
return fException;
|
|
94 |
}
|
|
95 |
} // class QName
|