com.sun.tools.xjc
Class ErrorReceiver

java.lang.Object
  extended by com.sun.tools.xjc.ErrorReceiver
All Implemented Interfaces:
com.sun.xml.bind.api.ErrorListener, org.xml.sax.ErrorHandler
Direct Known Subclasses:
ConsoleErrorReporter, ErrorReceiverFilter, ErrorReceiverImpl, SchemaCompilerImpl

public abstract class ErrorReceiver
extends java.lang.Object
implements org.xml.sax.ErrorHandler, ErrorListener

Implemented by the driver of the compiler engine to handle errors found during the compiliation.

This class implements ErrorHandler so it can be passed to anywhere where ErrorHandler is expected.

However, to make the error handling easy (and make it work with visitor patterns nicely), none of the methods on thi class throws SAXException. Instead, when the compilation needs to be aborted, it throws AbortException, which is unchecked.

This also implements the externally visible ErrorListener so that we can reuse our internal implementation for testing and such.


Constructor Summary
ErrorReceiver()
           
 
Method Summary
 void debug(java.lang.String msg)
          Reports a debug message to users.
 void error(java.lang.Exception e)
           
 void error(org.xml.sax.Locator loc, java.lang.String msg)
           
 void error(org.xml.sax.Locator loc, java.lang.String msg, java.lang.Exception e)
           
abstract  void error(org.xml.sax.SAXParseException exception)
           
 void error(java.lang.String msg, java.lang.Exception e)
           
abstract  void fatalError(org.xml.sax.SAXParseException exception)
           
protected  java.lang.String getLocationString(org.xml.sax.SAXParseException e)
          Returns the human readable string representation of the Locator part of the specified SAXParseException.
abstract  void info(org.xml.sax.SAXParseException exception)
          Reports verbose messages to users.
 void pollAbort()
          This method will be invoked periodically to allow AbortException to be thrown, especially when this is driven by some kind of GUI.
 void warning(org.xml.sax.Locator loc, java.lang.String msg)
           
abstract  void warning(org.xml.sax.SAXParseException exception)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorReceiver

public ErrorReceiver()
Method Detail

error

public final void error(org.xml.sax.Locator loc,
                        java.lang.String msg)
Parameters:
loc - can be null if the location is unknown

error

public final void error(org.xml.sax.Locator loc,
                        java.lang.String msg,
                        java.lang.Exception e)

error

public final void error(java.lang.String msg,
                        java.lang.Exception e)

error

public void error(java.lang.Exception e)

warning

public final void warning(org.xml.sax.Locator loc,
                          java.lang.String msg)
Parameters:
loc - can be null if the location is unknown

error

public abstract void error(org.xml.sax.SAXParseException exception)
                    throws AbortException
Specified by:
error in interface com.sun.xml.bind.api.ErrorListener
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
AbortException

fatalError

public abstract void fatalError(org.xml.sax.SAXParseException exception)
                         throws AbortException
Specified by:
fatalError in interface com.sun.xml.bind.api.ErrorListener
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
AbortException

warning

public abstract void warning(org.xml.sax.SAXParseException exception)
                      throws AbortException
Specified by:
warning in interface com.sun.xml.bind.api.ErrorListener
Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
AbortException

pollAbort

public void pollAbort()
               throws AbortException
This method will be invoked periodically to allow AbortException to be thrown, especially when this is driven by some kind of GUI.

Throws:
AbortException

info

public abstract void info(org.xml.sax.SAXParseException exception)
Reports verbose messages to users. This method can be used to report additional non-essential messages. The implementation usually discards them unless some specific debug option is turned on.

Specified by:
info in interface com.sun.xml.bind.api.ErrorListener

debug

public final void debug(java.lang.String msg)
Reports a debug message to users.

See Also:
info(SAXParseException)

getLocationString

protected final java.lang.String getLocationString(org.xml.sax.SAXParseException e)
Returns the human readable string representation of the Locator part of the specified SAXParseException.

Returns:
non-null valid object.