Top Description Constructors Methods
com.sun.tools.xjc

public abstract Class ErrorReceiver

extends Object
implements ErrorHandler, ErrorListener
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.api.ErrorListener, org.glassfish.jaxb.core.api.ErrorListener, org.xml.sax.ErrorHandler
Known Direct Subclasses
com.sun.tools.xjc.XJCBase.ErrorReceiverImpl, com.sun.tools.xjc.util.ErrorReceiverFilter, com.sun.tools.jxc.ap.ErrorReceiverImpl, com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl, com.sun.tools.xjc.ConsoleErrorReporter
Imports
com.sun.istack.SAXParseException2, com.sun.tools.xjc.api.ErrorListener, org.xml.sax.ErrorHandler, .Locator, .SAXParseException

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.

Author
Kohsuke Kawaguchi ([email protected])

Constructor Summary

AccessConstructor and Description
protected
ErrorReceiver()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public final void
debug(String msg)

Reports a debug message to users.

public final void
error(Locator
can be null if the location is unknown
loc
,
String msg)

public final void
public final void
public void
public abstract void
error(SAXParseException exception)

Redeclares org.xml.sax.ErrorHandler.error, com.sun.tools.xjc.api.ErrorListener.error.

Receive notification of a recoverable error.

public abstract void
fatalError(SAXParseException exception)

Redeclares org.xml.sax.ErrorHandler.fatalError, com.sun.tools.xjc.api.ErrorListener.fatalError.

Receive notification of a non-recoverable, fatal error.

protected final String

Returns:

non-null valid object.
getLocationString
(SAXParseException e)

Returns the human readable string representation of the org.xml.sax.Locator part of the specified SAXParseException.

private String
getShortName(String url)

Computes a short name of a given URL for display.

public abstract void
info(SAXParseException exception)

Redeclares com.sun.tools.xjc.api.ErrorListener.info.

Reports verbose messages to users.

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.

public final void
warning(Locator
can be null if the location is unknown
loc
,
String msg)

public abstract void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ErrorReceiverback to summary
protected ErrorReceiver()

Default constructor.

Method Detail

debugback to summary
public final void debug(String msg)

Reports a debug message to users.

See Also
info(SAXParseException)
errorback to summary
public final void error(Locator loc, String msg)
Parameters
loc:Locator

can be null if the location is unknown

errorback to summary
public final void error(Locator loc, String msg, Exception e)
errorback to summary
public final void error(String msg, Exception e)
errorback to summary
public void error(Exception e)
errorback to summary
public abstract void error(SAXParseException exception) throws AbortException

Redeclares org.xml.sax.ErrorHandler.error, com.sun.tools.xjc.api.ErrorListener.error.

Doc from org.xml.sax.ErrorHandler.error.

Receive notification of a recoverable error.

This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML recommendation does not require it to do so.

Filters may use this method to report other, non-XML errors as well.

Annotations
@Override
fatalErrorback to summary
public abstract void fatalError(SAXParseException exception) throws AbortException

Redeclares org.xml.sax.ErrorHandler.fatalError, com.sun.tools.xjc.api.ErrorListener.fatalError.

Doc from org.xml.sax.ErrorHandler.fatalError.

Receive notification of a non-recoverable, fatal error.

As defined in section 1.2 of the W3C XML 1.0 Recommendation, fatal errors are those that would make it impossible for a parser to continue normal processing. These include violation of a well-formedness constraint, invalid encoding, and forbidden structural errors as described in the W3C XML 1.0 Recommendation.

Annotations
@Override
getLocationStringback to summary
protected final String getLocationString(SAXParseException e)

Returns the human readable string representation of the org.xml.sax.Locator part of the specified SAXParseException.

Returns:String

non-null valid object.

getShortNameback to summary
private String getShortName(String url)

Computes a short name of a given URL for display.

infoback to summary
public abstract void info(SAXParseException exception)

Redeclares com.sun.tools.xjc.api.ErrorListener.info.

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.

Annotations
@Override
pollAbortback to summary
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.

warningback to summary
public final void warning(Locator loc, String msg)
Parameters
loc:Locator

can be null if the location is unknown

warningback to summary
public abstract void warning(SAXParseException exception) throws AbortException

Redeclares org.xml.sax.ErrorHandler.warning, com.sun.tools.xjc.api.ErrorListener.warning.

Doc from org.xml.sax.ErrorHandler.warning.

Receive notification of a warning.

SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML recommendation. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.

Filters may use this method to report other, non-XML warnings as well.

Annotations
@Override