com.sun.tools.xjc

Class ErrorReceiver

public abstract class ErrorReceiver extends Object implements 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 org.xml.sax.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.

Method Summary
voiddebug(String msg)
Reports a debug message to users.
voiderror(Locator loc, String msg)
voiderror(Locator loc, String msg, Exception e)
voiderror(String msg, Exception e)
voiderror(Exception e)
abstract voiderror(SAXParseException exception)
abstract voidfatalError(SAXParseException exception)
protected StringgetLocationString(SAXParseException e)
Returns the human readable string representation of the org.xml.sax.Locator part of the specified SAXParseException.
abstract voidinfo(SAXParseException exception)
Reports verbose messages to users.
voidpollAbort()
This method will be invoked periodically to allow AbortException to be thrown, especially when this is driven by some kind of GUI.
voidwarning(Locator loc, String msg)
abstract voidwarning(SAXParseException exception)

Method Detail

debug

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

See Also: info

error

public final void error(Locator loc, String msg)

Parameters: loc can be null if the location is unknown

error

public final void error(Locator loc, String msg, Exception e)

error

public final void error(String msg, Exception e)

error

public void error(Exception e)

error

public abstract void error(SAXParseException exception)

fatalError

public abstract void fatalError(SAXParseException exception)

getLocationString

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

Returns: non-null valid object.

info

public abstract void info(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.

pollAbort

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

warning

public final void warning(Locator loc, String msg)

Parameters: loc can be null if the location is unknown

warning

public abstract void warning(SAXParseException exception)