KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xni > XNIException


1 /*
2  * Copyright 2001, 2002,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 package org.apache.xerces.xni;
18
19 /**
20  * This exception is the base exception of all XNI exceptions. It
21  * can be constructed with an error message or used to wrap another
22  * exception object.
23  * <p>
24  * <strong>Note:</strong> By extending the Java
25  * <code>RuntimeException</code>, XNI handlers and components are
26  * not required to catch XNI exceptions but may explicitly catch
27  * them, if so desired.
28  *
29  * @author Andy Clark, IBM
30  *
31  * @version $Id: XNIException.java,v 1.5 2004/08/15 21:22:16 mrglavas Exp $
32  */

33 public class XNIException
34     extends RuntimeException JavaDoc {
35
36     /** Serialization version. */
37     static final long serialVersionUID = 9019819772686063775L;
38     
39     //
40
// Data
41
//
42

43     /** The wrapped exception. */
44     private Exception JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc message, Exception JavaDoc 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 JavaDoc getException() {
86         return fException;
87     } // getException():Exception
88

89 } // class QName
90
Popular Tags