jaxp/src/share/classes/org/xml/sax/SAXException.java
author kvn
Fri, 20 Jun 2008 11:10:05 -0700
changeset 762 1b26adb5fea1
parent 6 7f561c08de6b
permissions -rw-r--r--
6715633: when matching a memory node the adr_type should not change Summary: verify the adr_type of a mach node was not changed Reviewed-by: rasbold, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
// SAX exception class.
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
// http://www.saxproject.org
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
// No warranty; no copyright -- use this as you will.
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
// $Id: SAXException.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
package org.xml.sax;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * Encapsulate a general SAX error or warning.
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * <blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * <em>This module, both source code and documentation, is in the
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * for further information.
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * </blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * <p>This class can contain basic error or warning information from
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * either the XML parser or the application: a parser writer or
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * application writer can subclass it to provide additional
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * functionality.  SAX handlers may throw this exception or
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * any exception subclassed from it.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * <p>If the application needs to pass through other types of
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * exceptions, it must wrap those exceptions in a SAXException
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * or an exception derived from a SAXException.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * <p>If the parser or application needs to include information about a
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * specific location in an XML document, it should use the
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * @since SAX 1.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * @author David Megginson
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 * @see org.xml.sax.SAXParseException
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
public class SAXException extends Exception {
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
     * Create a new SAXException.
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
    public SAXException ()
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
        super();
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
        this.exception = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
     * Create a new SAXException.
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
     * @param message The error or warning message.
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
    public SAXException (String message) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
        super(message);
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
        this.exception = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
     * Create a new SAXException wrapping an existing exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
     * <p>The existing exception will be embedded in the new
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     * one, and its message will become the default message for
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     * the SAXException.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
     * @param e The exception to be wrapped in a SAXException.
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
    public SAXException (Exception e)
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
        super();
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
        this.exception = e;
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     * Create a new SAXException from an existing exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
     * <p>The existing exception will be embedded in the new
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
     * one, but the new exception will have its own message.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
     * @param message The detail message.
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
     * @param e The exception to be wrapped in a SAXException.
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
    public SAXException (String message, Exception e)
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
        super(message);
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
        this.exception = e;
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     * Return a detail message for this exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     * <p>If there is an embedded exception, and if the SAXException
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     * has no detail message of its own, this method will return
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     * the detail message from the embedded exception.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
     * @return The error or warning message.
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    public String getMessage ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
        String message = super.getMessage();
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
        if (message == null && exception != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
            return exception.getMessage();
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
            return message;
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
     * Return the embedded exception, if any.
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     * @return The embedded exception, or null if there is none.
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
    public Exception getException ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
        return exception;
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     * Override toString to pick up any embedded exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
     * @return A string representation of this exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    public String toString ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
        if (exception != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
            return exception.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
            return super.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    //////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
    // Internal state.
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    //////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * @serial The embedded exception if tunnelling, or null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    private Exception exception;
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
    // Added serialVersionUID to preserve binary compatibility
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    static final long serialVersionUID = 583241635256073760L;
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
}
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
// end of SAXException.java