FileDocCategorySizeDatePackage
DefaultErrorHandler.javaAPI DocJava SE 6 API3152Tue Jun 10 00:22:50 BST 2008com.sun.org.apache.xerces.internal.util

DefaultErrorHandler

public class DefaultErrorHandler extends Object implements XMLErrorHandler
Default error handler.
author
Andy Clark, IBM
version
$Id: DefaultErrorHandler.java,v 1.2.6.1 2005/09/05 07:49:27 neerajbj Exp $

Fields Summary
protected PrintWriter
fOut
Print writer.
Constructors Summary
public DefaultErrorHandler()
Constructs an error handler that prints error messages to System.err.

        this(new PrintWriter(System.err));
    
public DefaultErrorHandler(PrintWriter out)
Constructs an error handler that prints error messages to the specified PrintWriter

        fOut = out;
    
Methods Summary
public voiderror(java.lang.String domain, java.lang.String key, com.sun.org.apache.xerces.internal.xni.parser.XMLParseException ex)
Error.

        printError("Error", ex);
    
public voidfatalError(java.lang.String domain, java.lang.String key, com.sun.org.apache.xerces.internal.xni.parser.XMLParseException ex)
Fatal error.

        printError("Fatal Error", ex);
        throw ex;
    
private voidprintError(java.lang.String type, com.sun.org.apache.xerces.internal.xni.parser.XMLParseException ex)
Prints the error message.


        fOut.print("[");
        fOut.print(type);
        fOut.print("] ");
        String systemId = ex.getExpandedSystemId();
        if (systemId != null) {
            int index = systemId.lastIndexOf('/");
            if (index != -1)
                systemId = systemId.substring(index + 1);
            fOut.print(systemId);
        }
        fOut.print(':");
        fOut.print(ex.getLineNumber());
        fOut.print(':");
        fOut.print(ex.getColumnNumber());
        fOut.print(": ");
        fOut.print(ex.getMessage());
        fOut.println();
        fOut.flush();

    
public voidwarning(java.lang.String domain, java.lang.String key, com.sun.org.apache.xerces.internal.xni.parser.XMLParseException ex)
Warning.

        printError("Warning", ex);