001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: // SAX exception class.
028: package org.xml.sax;
029:
030: /**
031: * Encapsulate a general SAX error or warning.
032: *
033: * <blockquote>
034: * <em>This module, both source code and documentation, is in the
035: * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
036: * </blockquote>
037: *
038: * <p>This class can contain basic error or warning information from
039: * either the XML parser or the application: a parser writer or
040: * application writer can subclass it to provide additional
041: * functionality. SAX handlers may throw this exception or
042: * any exception subclassed from it.</p>
043: *
044: * <p>If the application needs to pass through other types of
045: * exceptions, it must wrap those exceptions in a SAXException
046: * or an exception derived from a SAXException.</p>
047: *
048: * <p>If the parser or application needs to include information about a
049: * specific location in an XML document, it should use the
050: * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
051: *
052: * @since SAX 1.0
053: *
054: * @version 2.0
055: * @see org.xml.sax.SAXParseException
056: */
057: public class SAXException extends Exception {
058:
059: /**
060: * Create a new SAXException.
061: *
062: * @param message The error or warning message.
063: */
064: public SAXException(String message) {
065: super (message);
066: // this.exception = null;
067: }
068:
069: /**
070: * Create a new SAXException wrapping an existing exception.
071: *
072: * <p>The existing exception will be embedded in the new
073: * one, and its message will become the default message for
074: * the SAXException.</p>
075: *
076: * @param e The exception to be wrapped in a SAXException.
077: */
078: /*
079: public SAXException (Exception e)
080: {
081: super();
082: this.exception = e;
083: }
084: */
085:
086: /**
087: * Create a new SAXException from an existing exception.
088: *
089: * <p>The existing exception will be embedded in the new
090: * one, but the new exception will have its own message.</p>
091: *
092: * @param message The detail message.
093: * @param e The exception to be wrapped in a SAXException.
094: */
095: /*
096: public SAXException (String message, Exception e)
097: {
098: super(message);
099: // this.exception = e;
100: }
101: */
102:
103: /**
104: * Return a detail message for this exception.
105: *
106: * <p>If there is an embedded exception, and if the SAXException
107: * has no detail message of its own, this method will return
108: * the detail message from the embedded exception.</p>
109: *
110: * @return The error or warning message.
111: */
112: /*
113: public String getMessage ()
114: {
115: String message = super.getMessage();
116:
117: if (message == null && exception != null) {
118: return exception.getMessage();
119: } else {
120: return message;
121: }
122: }
123: */
124:
125: /**
126: * Return the embedded exception, if any.
127: *
128: * @return The embedded exception, or null if there is none.
129: */
130: /*
131: public Exception getException ()
132: {
133: return exception;
134: }
135: */
136:
137: /**
138: * Override toString to pick up any embedded exception.
139: *
140: * @return A string representation of this exception.
141: */
142: /*
143: public String toString ()
144: {
145: if (exception != null) {
146: return exception.toString();
147: } else {
148: return super.toString();
149: }
150: }
151: */
152:
153: //////////////////////////////////////////////////////////////////////
154: // Internal state.
155: //////////////////////////////////////////////////////////////////////
156:
157: /**
158: * @serial The embedded exception if tunnelling, or null.
159: */
160: // private Exception exception;
161: }
162:
163: // end of SAXException.java
|