org.enhydra.xml.io
Class ErrorReporter

java.lang.Object
  |
  +--org.enhydra.xml.io.ErrorReporter
All Implemented Interfaces:
ErrorHandler

public class ErrorReporter
extends Object
implements ErrorHandler

Object used to report error message for the user. Can write eror messages to a file or save them in a memory buffer. This is also a SAX compliant ErrorHandler.


Constructor Summary
ErrorReporter()
          Construct a new error report object with output saved in a string buffer.
ErrorReporter(PrintStream output)
          Construct a new error report object.
ErrorReporter(PrintWriter output)
          Construct a new error report object.
 
Method Summary
 void error(SAXParseException exception)
          Receive notification of a SAX recoverable error.
 void error(String msg)
          Report an error.
 void error(String msg, Locator locator)
          Report an error with file name and line number.
 void error(String msg, String fileName, int lineNum)
          Report an error with file name and line number.
 void error(String msg, Throwable except)
          Report an error from an exception
 void fatalError(SAXParseException exception)
          Receive notification of a SAX non-recoverable error.
 int getErrorCnt()
          Get the count of errors that have occured.
 String getOutput()
          Get the buffer containing the output if internal buffering has been used.
 boolean getPrintDebug()
          Get the value of the printDebug flag.
 boolean getPrintWarnings()
          Get the value of the printWarnings flag.
 int getWarningCnt()
          Get the count of warnings that have occured.
 void setPrintDebug(boolean value)
          Set the value of the printDebug flag.
 void setPrintWarnings(boolean value)
          Set the value of the printWarnings flag.
 void warning(SAXParseException exception)
          Receive notification of a SAX warning.
 void warning(String msg)
          Report a warning.
 void warning(String msg, Locator locator)
          Report a warning with file name and line number.
 void warning(String msg, String fileName, int lineNum)
          Report a warning with file name and line number.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorReporter

public ErrorReporter(PrintWriter output)
Construct a new error report object.
Parameters:
output - Writer to recieve error output.

ErrorReporter

public ErrorReporter(PrintStream output)
Construct a new error report object.
Parameters:
output - PrintStream to recieve error output.

ErrorReporter

public ErrorReporter()
Construct a new error report object with output saved in a string buffer.
Method Detail

getPrintWarnings

public boolean getPrintWarnings()
Get the value of the printWarnings flag.

setPrintWarnings

public void setPrintWarnings(boolean value)
Set the value of the printWarnings flag.

getPrintDebug

public boolean getPrintDebug()
Get the value of the printDebug flag.

setPrintDebug

public void setPrintDebug(boolean value)
Set the value of the printDebug flag. This controls the printing of stack traces that are normally supressed.

getErrorCnt

public int getErrorCnt()
Get the count of errors that have occured.

getWarningCnt

public int getWarningCnt()
Get the count of warnings that have occured.

getOutput

public String getOutput()
Get the buffer containing the output if internal buffering has been used.
Returns:
buffer containing output or null if output was written to an external stream.

error

public void error(String msg)
Report an error.

error

public void error(String msg,
                  String fileName,
                  int lineNum)
Report an error with file name and line number.

error

public void error(String msg,
                  Locator locator)
Report an error with file name and line number.

error

public void error(String msg,
                  Throwable except)
Report an error from an exception

warning

public void warning(String msg)
Report a warning.

warning

public void warning(String msg,
                    String fileName,
                    int lineNum)
Report a warning with file name and line number.

warning

public void warning(String msg,
                    Locator locator)
Report a warning with file name and line number.

warning

public void warning(SAXParseException exception)
             throws SAXException
Receive notification of a SAX warning.
Specified by:
warning in interface ErrorHandler

error

public void error(SAXParseException exception)
           throws SAXException
Receive notification of a SAX recoverable error.
Specified by:
error in interface ErrorHandler

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException
Receive notification of a SAX non-recoverable error.
Specified by:
fatalError in interface ErrorHandler


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.