net.n3.nanoxml
Class XMLException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by net.n3.nanoxml.XMLException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XMLParseException, XMLValidationException

public class XMLException
extends java.lang.Exception

An XMLException is thrown when an exception occurred while processing the XML data.

Version:
$Name: RELEASE_2_2_1 $, $Revision: 1.4 $
Author:
Marc De Scheemaecker
See Also:
Serialized Form

Field Summary
private  java.lang.Exception encapsulatedException
          Encapsulated exception.
private  int lineNr
          The line number in the XML data where the exception occurred.
private  java.lang.String msg
          The message of the exception.
private  java.lang.String systemID
          The system ID of the XML data where the exception occurred.
 
Constructor Summary
XMLException(java.lang.Exception e)
          Creates a new exception.
XMLException(java.lang.String msg)
          Creates a new exception.
XMLException(java.lang.String systemID, int lineNr, java.lang.Exception e)
          Creates a new exception.
XMLException(java.lang.String systemID, int lineNr, java.lang.Exception e, java.lang.String msg, boolean reportParams)
          Creates a new exception.
XMLException(java.lang.String systemID, int lineNr, java.lang.String msg)
          Creates a new exception.
 
Method Summary
private static java.lang.String buildMessage(java.lang.String systemID, int lineNr, java.lang.Exception e, java.lang.String msg, boolean reportParams)
          Builds the exception message
protected  void finalize()
          Cleans up the object when it's destroyed.
 java.lang.Exception getException()
          Returns the encapsulated exception, or null if no exception is encapsulated.
 int getLineNr()
          Returns the line number in the XML data where the exception occurred.
 java.lang.String getSystemID()
          Returns the system ID of the XML data where the exception occurred.
 void printStackTrace()
          Dumps the exception stack to System.err.
 void printStackTrace(java.io.PrintStream stream)
          Dumps the exception stack to an output stream.
 void printStackTrace(java.io.PrintWriter writer)
          Dumps the exception stack to a print writer.
 java.lang.String toString()
          Returns a string representation of the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

msg

private java.lang.String msg
The message of the exception.


systemID

private java.lang.String systemID
The system ID of the XML data where the exception occurred.


lineNr

private int lineNr
The line number in the XML data where the exception occurred.


encapsulatedException

private java.lang.Exception encapsulatedException
Encapsulated exception.

Constructor Detail

XMLException

public XMLException(java.lang.String msg)
Creates a new exception.

Parameters:
msg - the message of the exception.

XMLException

public XMLException(java.lang.Exception e)
Creates a new exception.

Parameters:
e - the encapsulated exception.

XMLException

public XMLException(java.lang.String systemID,
                    int lineNr,
                    java.lang.Exception e)
Creates a new exception.

Parameters:
systemID - the system ID of the XML data where the exception occurred
lineNr - the line number in the XML data where the exception occurred.
e - the encapsulated exception.

XMLException

public XMLException(java.lang.String systemID,
                    int lineNr,
                    java.lang.String msg)
Creates a new exception.

Parameters:
systemID - the system ID of the XML data where the exception occurred
lineNr - the line number in the XML data where the exception occurred.
msg - the message of the exception.

XMLException

public XMLException(java.lang.String systemID,
                    int lineNr,
                    java.lang.Exception e,
                    java.lang.String msg,
                    boolean reportParams)
Creates a new exception.

Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception occurred.
e - the encapsulated exception.
msg - the message of the exception.
reportParams - true if the systemID, lineNr and e params need to be appended to the message
Method Detail

buildMessage

private static java.lang.String buildMessage(java.lang.String systemID,
                                             int lineNr,
                                             java.lang.Exception e,
                                             java.lang.String msg,
                                             boolean reportParams)
Builds the exception message

Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception occurred.
e - the encapsulated exception.
msg - the message of the exception.
reportParams - true if the systemID, lineNr and e params need to be appended to the message

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up the object when it's destroyed.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getSystemID

public java.lang.String getSystemID()
Returns the system ID of the XML data where the exception occurred. If there is no system ID known, null is returned.


getLineNr

public int getLineNr()
Returns the line number in the XML data where the exception occurred. If there is no line number known, -1 is returned.


getException

public java.lang.Exception getException()
Returns the encapsulated exception, or null if no exception is encapsulated.


printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Dumps the exception stack to a print writer.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - the print writer

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Dumps the exception stack to an output stream.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - the output stream

printStackTrace

public void printStackTrace()
Dumps the exception stack to System.err.

Overrides:
printStackTrace in class java.lang.Throwable

toString

public java.lang.String toString()
Returns a string representation of the exception.

Overrides:
toString in class java.lang.Throwable