APIdia Launch Partner
Top Description Fields Constructors Methods
org.xml.sax

public Class SAXException

extends Exception
Class Inheritance
Known Direct Subclasses
org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException, org.xml.sax.SAXParseException, com.sun.org.apache.xml.internal.utils.StopParseException, com.sun.org.apache.xalan.internal.xsltc.TransletException
Imports
java.io.IOException, .InvalidClassException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamField

Encapsulate a general SAX error or warning.

This class can contain basic error or warning information from either the XML parser or the application: a parser writer or application writer can subclass it to provide additional functionality. SAX handlers may throw this exception or any exception subclassed from it.

If the application needs to pass through other types of exceptions, it must wrap those exceptions in a SAXException or an exception derived from a SAXException.

If the parser or application needs to include information about a specific location in an XML document, it should use the SAXParseException subclass.

Author
David Megginson
Since
1.4, SAX 1.0
Version
2.0.1 (sax2r2)
See Also
org.xml.sax.SAXParseException

Field Summary

Modifier and TypeField and Description
private static final ObjectStreamField[]
serialPersistentFields

serializable fields

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
SAXException()

Create a new SAXException.

public
SAXException(String
The error or warning message.
message
)

Create a new SAXException.

public
SAXException(Exception
The exception to be wrapped in a SAXException.
e
)

Create a new SAXException wrapping an existing exception.

public
SAXException(String
The detail message.
message
,
Exception
The exception to be wrapped in a SAXException.
e
)

Create a new SAXException from an existing exception.

Method Summary

Modifier and TypeMethod and Description
public Throwable

Returns:

Return the cause of the exception
getCause
()

Overrides java.lang.Throwable.getCause.

Return the cause of the exception

public Exception

Returns:

The embedded exception, or null if there is none.
getException
()

Return the embedded exception, if any.

private Exception
public String

Returns:

The error or warning message.
getMessage
()

Overrides java.lang.Throwable.getMessage.

Return a detail message for this exception.

private void
readObject(ObjectInputStream
stream used for deserialization
in
)

Hides java.lang.Throwable.readObject.

Reads the "exception" field from the stream.

public String

Returns:

A string representation of this exception.
toString
()

Overrides java.lang.Throwable.toString.

Override toString to pick up any embedded exception.

private void
writeObject(ObjectOutputStream
stream used for serialization.
out
)

Hides java.lang.Throwable.writeObject.

Writes "exception" field to the stream.

Field Detail

serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields

serializable fields

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Constructor Detail

SAXExceptionback to summary
public SAXException()

Create a new SAXException.

SAXExceptionback to summary
public SAXException(String message)

Create a new SAXException.

Parameters
message:String

The error or warning message.

SAXExceptionback to summary
public SAXException(Exception e)

Create a new SAXException wrapping an existing exception.

The existing exception will be embedded in the new one, and its message will become the default message for the SAXException.

Parameters
e:Exception

The exception to be wrapped in a SAXException.

SAXExceptionback to summary
public SAXException(String message, Exception e)

Create a new SAXException from an existing exception.

The existing exception will be embedded in the new one, but the new exception will have its own message.

Parameters
message:String

The detail message.

e:Exception

The exception to be wrapped in a SAXException.

Method Detail

getCauseback to summary
public Throwable getCause()

Overrides java.lang.Throwable.getCause.

Return the cause of the exception

Returns:Throwable

Return the cause of the exception

getExceptionback to summary
public Exception getException()

Return the embedded exception, if any.

Returns:Exception

The embedded exception, or null if there is none.

getExceptionInternalback to summary
private Exception getExceptionInternal()
getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Return a detail message for this exception.

If there is an embedded exception, and if the SAXException has no detail message of its own, this method will return the detail message from the embedded exception.

Returns:String

The error or warning message.

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides java.lang.Throwable.readObject.

Reads the "exception" field from the stream. And initializes the "exception" if it wasn't done before.

Parameters
in:ObjectInputStream

stream used for deserialization

Exceptions
IOException:
thrown by ObjectInputStream
ClassNotFoundException:
thrown by ObjectInputStream
toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Override toString to pick up any embedded exception.

Returns:String

A string representation of this exception.

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Hides java.lang.Throwable.writeObject.

Writes "exception" field to the stream.

Parameters
out:ObjectOutputStream

stream used for serialization.

Exceptions
IOException:
thrown by ObjectOutputStream