net.sf.joost.stx
Class ErrorHandlerImpl

java.lang.Object
  extended by net.sf.joost.stx.ErrorHandlerImpl
All Implemented Interfaces:
ErrorHandler

public final class ErrorHandlerImpl
extends Object
implements ErrorHandler

Class for receiving notifications of warnings and errors and for passing them to a registered ErrorListener object.

Version:
$Revision: 1.4 $ $Date: 2009/08/21 12:46:17 $
Author:
Oliver Becker

Field Summary
private  boolean configurationFlag
          if set to true this object creates TransformerConfigurationExceptions
 ErrorListener errorListener
          Optional ErrorListener object
 
Constructor Summary
ErrorHandlerImpl()
          Default constructor, no ErrorListener registered
ErrorHandlerImpl(boolean configurationFlag)
          Constructs an ErrorHandlerImpl, no ErrorListener registered
ErrorHandlerImpl(ErrorListener el)
          Constructs an ErrorHandlerImpl and registers an ErrorListener.
ErrorHandlerImpl(ErrorListener el, boolean configurationFlag)
          Constructs an ErrorHandlerImpl and registers an ErrorListener.
 
Method Summary
 void error(SAXParseException pe)
          Receive a notification of a recoverable error from the parser.
 void error(String msg, Locator loc, Throwable cause)
          Reports a recoverable error to a registered errorListener.
 void error(String msg, String pubId, String sysId, int lineNo, int colNo)
          Calls error(String, String, String, int, int, Throwable) with the cause parameter set to null.
 void error(String msg, String pubId, String sysId, int lineNo, int colNo, Throwable cause)
          Reports a recoverable error to a registered errorListener.
 void error(TransformerException te)
          Reports a recoverable error to a registered errorListener.
 void fatalError(SAXParseException pe)
          Receive a notification of a non-recoverable error from the parser.
 void fatalError(String msg, Locator loc, Throwable cause)
          Reports a non-recoverable error to a registered errorListener.
 void fatalError(String msg, String pubId, String sysId, int lineNo, int colNo)
          Calls fatalError(String, String, String, int, int, Throwable) with the cause parameter set to null.
 void fatalError(String msg, String pubId, String sysId, int lineNo, int colNo, Throwable cause)
          Reports a non-recoverable error to a registered errorListener
 void fatalError(TransformerException te)
          Reports a non-recoverable error to a registered errorListener
private  TransformerException newException(String msg, SourceLocator sl, Throwable cause)
          Creates an Exception dependent from the value of configurationFlag
 void warning(SAXParseException pe)
          Receive a notification of a warning from the parser.
 void warning(String msg, Locator loc, Throwable cause)
          Reports a warning to a registered errorListener.
 void warning(String msg, String pubId, String sysId, int lineNo, int colNo)
          Calls warning(String, String, String, int, int, Throwable) with the cause parameter set to null.
 void warning(String msg, String pubId, String sysId, int lineNo, int colNo, Throwable cause)
          Reports a warning to a registered errorListener.
 void warning(TransformerException te)
          Reports a warning to a registered errorListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorListener

public ErrorListener errorListener
Optional ErrorListener object


configurationFlag

private boolean configurationFlag
if set to true this object creates TransformerConfigurationExceptions

Constructor Detail

ErrorHandlerImpl

public ErrorHandlerImpl()
Default constructor, no ErrorListener registered


ErrorHandlerImpl

public ErrorHandlerImpl(ErrorListener el)
Constructs an ErrorHandlerImpl and registers an ErrorListener.

Parameters:
el - the ErrorLister for this object

ErrorHandlerImpl

public ErrorHandlerImpl(boolean configurationFlag)
Constructs an ErrorHandlerImpl, no ErrorListener registered

Parameters:
configurationFlag - if set to true then this handler constructs TransformerConfigurationExceptions rather than TransformerExceptions

ErrorHandlerImpl

public ErrorHandlerImpl(ErrorListener el,
                        boolean configurationFlag)
Constructs an ErrorHandlerImpl and registers an ErrorListener.

Parameters:
el - the ErrorLister for this object
configurationFlag - if set to true then this handler constructs TransformerConfigurationExceptions rather than TransformerExceptions
Method Detail

newException

private TransformerException newException(String msg,
                                          SourceLocator sl,
                                          Throwable cause)
Creates an Exception dependent from the value of configurationFlag


warning

public void warning(String msg,
                    Locator loc,
                    Throwable cause)
             throws SAXException
Reports a warning to a registered errorListener. Does nothing if there's no such listener object.

Parameters:
msg - the message of this warning
loc - a SAX Locator object
cause - an optional Throwable that caused this warning
Throws:
SAXException - wrapping a TransformerException

warning

public void warning(String msg,
                    String pubId,
                    String sysId,
                    int lineNo,
                    int colNo,
                    Throwable cause)
             throws SAXException
Reports a warning to a registered errorListener. Does nothing if there's no such listener object.

Parameters:
msg - the message of this warning
pubId - the public identifier of the source
sysId - the system identifier of the source
lineNo - the line number in the source which causes the warning
colNo - the column number in the source which causes the warning
cause - an optional Throwable that caused this warning
Throws:
SAXException - wrapping a TransformerException

warning

public void warning(String msg,
                    String pubId,
                    String sysId,
                    int lineNo,
                    int colNo)
             throws SAXException
Calls warning(String, String, String, int, int, Throwable) with the cause parameter set to null.

Throws:
SAXException

warning

public void warning(TransformerException te)
             throws SAXException
Reports a warning to a registered errorListener. Does nothing if there's no such listener object.

Parameters:
te - the warning encapsulated in a TransformerException
Throws:
SAXException - wrapping a TransformerException

warning

public void warning(SAXParseException pe)
             throws SAXException
Receive a notification of a warning from the parser. If an errorListener was registered, the provided parameter SAXParseException will be passed to this object wrapped in a TransformerException

Specified by:
warning in interface ErrorHandler
Throws:
SAXException - wrapping TransformerException

error

public void error(String msg,
                  Locator loc,
                  Throwable cause)
           throws SAXException
Reports a recoverable error to a registered errorListener.

Parameters:
msg - the message of this error
loc - a SAX Locator object
cause - an optional Throwable that caused this error
Throws:
SAXException - wrapping a TransformerException

error

public void error(String msg,
                  String pubId,
                  String sysId,
                  int lineNo,
                  int colNo,
                  Throwable cause)
           throws SAXException
Reports a recoverable error to a registered errorListener.

Parameters:
msg - the message of this error
pubId - the public identifier of the source
sysId - the system identifier of the source
lineNo - the line number in the source which causes the error
colNo - the column number in the source which causes the error
cause - an optional Throwable that caused this error
Throws:
SAXException - wrapping a TransformerException

error

public void error(String msg,
                  String pubId,
                  String sysId,
                  int lineNo,
                  int colNo)
           throws SAXException
Calls error(String, String, String, int, int, Throwable) with the cause parameter set to null.

Throws:
SAXException

error

public void error(TransformerException te)
           throws SAXException
Reports a recoverable error to a registered errorListener.

Parameters:
te - the error encapsulated in a TransformerException
Throws:
SAXException - wrapping a TransformerException

error

public void error(SAXParseException pe)
           throws SAXException
Receive a notification of a recoverable error from the parser. If an errorListener was registered, the provided parameter SAXParseException will be passed to this object wrapped in a TransformerException

Specified by:
error in interface ErrorHandler
Throws:
SAXException - wrapping a TransformerException

fatalError

public void fatalError(String msg,
                       Locator loc,
                       Throwable cause)
                throws SAXException
Reports a non-recoverable error to a registered errorListener.

Parameters:
msg - the message of this error
loc - a SAX Locator object
cause - an optional Throwable that caused this error
Throws:
SAXException - wrapping a TransformerException

fatalError

public void fatalError(String msg,
                       String pubId,
                       String sysId,
                       int lineNo,
                       int colNo,
                       Throwable cause)
                throws SAXException
Reports a non-recoverable error to a registered errorListener

Parameters:
msg - the message of this error
pubId - the public identifier of the source
sysId - the system identifier of the source
lineNo - the line number in the source which causes the error
colNo - the column number in the source which causes the error
cause - an optional Throwable that caused this error
Throws:
SAXException - wrapping a TransformerException

fatalError

public void fatalError(String msg,
                       String pubId,
                       String sysId,
                       int lineNo,
                       int colNo)
                throws SAXException
Calls fatalError(String, String, String, int, int, Throwable) with the cause parameter set to null.

Throws:
SAXException

fatalError

public void fatalError(TransformerException te)
                throws SAXException
Reports a non-recoverable error to a registered errorListener

Parameters:
te - the error encapsulated in a TransformerException
Throws:
SAXException - wrapping a TransformerException

fatalError

public void fatalError(SAXParseException pe)
                throws SAXException
Receive a notification of a non-recoverable error from the parser. If an errorListener was registered, the provided parameter SAXParseException will be passed to this object wrapped in a TransformerException

Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException - wrapping a TransformerException