mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-31 06:54:42 +08:00
18e1f2bd67
* HACKING, gnu/gcj/xlib/Pixmap.java, gnu/gcj/xlib/XException.java, gnu/java/rmi/rmic/RMIC.java, java/awt/Window.java, java/awt/AWTEvent.java, java/io/ByteArrayOutputStream.java, java/io/CharConversionException.java, java/io/PipedInputStream.java, java/io/PipedReader.java, java/io/PrintWriter.java, java/io/WriteAbortedException.java, java/io/natFileWin32.cc, java/lang/Class.h, java/lang/natClassLoader.cc, java/lang/natObject.cc, java/lang/Package.java, java/net/BindException.java, java/net/ConnectException.java, java/net/ProtocolException.java, java/net/SocketException.java, java/net/UnknownServiceException.java, java/security/cert/X509Certificate.java, java/security/interfaces/DSAKey.java, java/security/SecureRandom.java, java/security/SignedObject.java, java/sql/DatabaseMetaData.java, java/text/DecimalFormatSymbols.java, java/util/jar/Attributes.java, java/util/jar/JarEntry.java, java/util/jar/JarInputStream.java, java/util/jar/JarOutputStream.java, java/util/Calendar.java, java/util/Collections.java, java/util/GregorianCalendar.java, java/util/HashMap.java, java/util/List.java, java/util/Properties.java, java/util/Timer.java, java/util/Vector.java, java/util/WeakHashMap.java, javax/naming/NamingException.java, testsuite/libjava.lang/Thread_Wait.java, org/xml/sax/helpers/DefaultHandler.java, org/xml/sax/HandlerBase.java, org/xml/sax/SAXParseException.java, ChangeLog, acinclude.m4, aclocal.m4, posix-threads.cc: Fix spelling errors. * configure: Regenerate. From-SVN: r46665
265 lines
8.5 KiB
Java
265 lines
8.5 KiB
Java
// SAX exception class.
|
||
// No warranty; no copyright -- use this as you will.
|
||
// $Id: SAXParseException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
|
||
|
||
package org.xml.sax;
|
||
|
||
/**
|
||
* Encapsulate an XML parse error or warning.
|
||
*
|
||
* <blockquote>
|
||
* <em>This module, both source code and documentation, is in the
|
||
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
|
||
* </blockquote>
|
||
*
|
||
* <p>This exception will include information for locating the error
|
||
* in the original XML document. Note that although the application
|
||
* will receive a SAXParseException as the argument to the handlers
|
||
* in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
|
||
* the application is not actually required to throw the exception;
|
||
* instead, it can simply read the information in it and take a
|
||
* different action.</p>
|
||
*
|
||
* <p>Since this exception is a subclass of {@link org.xml.sax.SAXException
|
||
* SAXException}, it inherits the ability to wrap another exception.</p>
|
||
*
|
||
* @since SAX 1.0
|
||
* @author David Megginson,
|
||
* <a href="mailto:sax@megginson.com">sax@megginson.com</a>
|
||
* @version 2.0
|
||
* @see org.xml.sax.SAXException
|
||
* @see org.xml.sax.Locator
|
||
* @see org.xml.sax.ErrorHandler
|
||
*/
|
||
public class SAXParseException extends SAXException {
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Constructors.
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
/**
|
||
* Create a new SAXParseException from a message and a Locator.
|
||
*
|
||
* <p>This constructor is especially useful when an application is
|
||
* creating its own exception from within a {@link org.xml.sax.ContentHandler
|
||
* ContentHandler} callback.</p>
|
||
*
|
||
* @param message The error or warning message.
|
||
* @param locator The locator object for the error or warning (may be
|
||
* null).
|
||
* @see org.xml.sax.Locator
|
||
* @see org.xml.sax.Parser#setLocale
|
||
*/
|
||
public SAXParseException (String message, Locator locator) {
|
||
super(message);
|
||
if (locator != null) {
|
||
init(locator.getPublicId(), locator.getSystemId(),
|
||
locator.getLineNumber(), locator.getColumnNumber());
|
||
} else {
|
||
init(null, null, -1, -1);
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* Wrap an existing exception in a SAXParseException.
|
||
*
|
||
* <p>This constructor is especially useful when an application is
|
||
* creating its own exception from within a {@link org.xml.sax.ContentHandler
|
||
* ContentHandler} callback, and needs to wrap an existing exception that is not a
|
||
* subclass of {@link org.xml.sax.SAXException SAXException}.</p>
|
||
*
|
||
* @param message The error or warning message, or null to
|
||
* use the message from the embedded exception.
|
||
* @param locator The locator object for the error or warning (may be
|
||
* null).
|
||
* @param e Any exception.
|
||
* @see org.xml.sax.Locator
|
||
* @see org.xml.sax.Parser#setLocale
|
||
*/
|
||
public SAXParseException (String message, Locator locator,
|
||
Exception e) {
|
||
super(message, e);
|
||
if (locator != null) {
|
||
init(locator.getPublicId(), locator.getSystemId(),
|
||
locator.getLineNumber(), locator.getColumnNumber());
|
||
} else {
|
||
init(null, null, -1, -1);
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* Create a new SAXParseException.
|
||
*
|
||
* <p>This constructor is most useful for parser writers.</p>
|
||
*
|
||
* <p>If the system identifier is a URL, the parser must resolve it
|
||
* fully before creating the exception.</p>
|
||
*
|
||
* @param message The error or warning message.
|
||
* @param publicId The public identifier of the entity that generated
|
||
* the error or warning.
|
||
* @param systemId The system identifier of the entity that generated
|
||
* the error or warning.
|
||
* @param lineNumber The line number of the end of the text that
|
||
* caused the error or warning.
|
||
* @param columnNumber The column number of the end of the text that
|
||
* cause the error or warning.
|
||
* @see org.xml.sax.Parser#setLocale
|
||
*/
|
||
public SAXParseException (String message, String publicId, String systemId,
|
||
int lineNumber, int columnNumber)
|
||
{
|
||
super(message);
|
||
init(publicId, systemId, lineNumber, columnNumber);
|
||
}
|
||
|
||
|
||
/**
|
||
* Create a new SAXParseException with an embedded exception.
|
||
*
|
||
* <p>This constructor is most useful for parser writers who
|
||
* need to wrap an exception that is not a subclass of
|
||
* {@link org.xml.sax.SAXException SAXException}.</p>
|
||
*
|
||
* <p>If the system identifier is a URL, the parser must resolve it
|
||
* fully before creating the exception.</p>
|
||
*
|
||
* @param message The error or warning message, or null to use
|
||
* the message from the embedded exception.
|
||
* @param publicId The public identifier of the entity that generated
|
||
* the error or warning.
|
||
* @param systemId The system identifier of the entity that generated
|
||
* the error or warning.
|
||
* @param lineNumber The line number of the end of the text that
|
||
* caused the error or warning.
|
||
* @param columnNumber The column number of the end of the text that
|
||
* cause the error or warning.
|
||
* @param e Another exception to embed in this one.
|
||
* @see org.xml.sax.Parser#setLocale
|
||
*/
|
||
public SAXParseException (String message, String publicId, String systemId,
|
||
int lineNumber, int columnNumber, Exception e)
|
||
{
|
||
super(message, e);
|
||
init(publicId, systemId, lineNumber, columnNumber);
|
||
}
|
||
|
||
|
||
/**
|
||
* Internal initialization method.
|
||
*
|
||
* @param publicId The public identifier of the entity which generated the exception,
|
||
* or null.
|
||
* @param systemId The system identifier of the entity which generated the exception,
|
||
* or null.
|
||
* @param lineNumber The line number of the error, or -1.
|
||
* @param columnNumber The column number of the error, or -1.
|
||
*/
|
||
private void init (String publicId, String systemId,
|
||
int lineNumber, int columnNumber)
|
||
{
|
||
this.publicId = publicId;
|
||
this.systemId = systemId;
|
||
this.lineNumber = lineNumber;
|
||
this.columnNumber = columnNumber;
|
||
}
|
||
|
||
|
||
/**
|
||
* Get the public identifier of the entity where the exception occurred.
|
||
*
|
||
* @return A string containing the public identifier, or null
|
||
* if none is available.
|
||
* @see org.xml.sax.Locator#getPublicId
|
||
*/
|
||
public String getPublicId ()
|
||
{
|
||
return this.publicId;
|
||
}
|
||
|
||
|
||
/**
|
||
* Get the system identifier of the entity where the exception occurred.
|
||
*
|
||
* <p>If the system identifier is a URL, it will be resolved
|
||
* fully.</p>
|
||
*
|
||
* @return A string containing the system identifier, or null
|
||
* if none is available.
|
||
* @see org.xml.sax.Locator#getSystemId
|
||
*/
|
||
public String getSystemId ()
|
||
{
|
||
return this.systemId;
|
||
}
|
||
|
||
|
||
/**
|
||
* The line number of the end of the text where the exception occurred.
|
||
*
|
||
* @return An integer representing the line number, or -1
|
||
* if none is available.
|
||
* @see org.xml.sax.Locator#getLineNumber
|
||
*/
|
||
public int getLineNumber ()
|
||
{
|
||
return this.lineNumber;
|
||
}
|
||
|
||
|
||
/**
|
||
* The column number of the end of the text where the exception occurred.
|
||
*
|
||
* <p>The first column in a line is position 1.</p>
|
||
*
|
||
* @return An integer representing the column number, or -1
|
||
* if none is available.
|
||
* @see org.xml.sax.Locator#getColumnNumber
|
||
*/
|
||
public int getColumnNumber ()
|
||
{
|
||
return this.columnNumber;
|
||
}
|
||
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Internal state.
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
/**
|
||
* @serial The public identifier, or null.
|
||
* @see #getPublicId
|
||
*/
|
||
private String publicId;
|
||
|
||
|
||
/**
|
||
* @serial The system identifier, or null.
|
||
* @see #getSystemId
|
||
*/
|
||
private String systemId;
|
||
|
||
|
||
/**
|
||
* @serial The line number, or -1.
|
||
* @see #getLineNumber
|
||
*/
|
||
private int lineNumber;
|
||
|
||
|
||
/**
|
||
* @serial The column number, or -1.
|
||
* @see #getColumnNumber
|
||
*/
|
||
private int columnNumber;
|
||
|
||
}
|
||
|
||
// end of SAXParseException.java
|