Source Code Cross Referenced for SAXException.java in  » 6.0-JDK-Core » xml » org » xml » sax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » org.xml.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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