Class ErrorReceiver

  • All Implemented Interfaces:
    com.sun.tools.xjc.api.ErrorListener, com.sun.xml.bind.api.ErrorListener, ErrorHandler
    Direct Known Subclasses:
    ConsoleErrorReporter, ErrorReceiverFilter

    public abstract class ErrorReceiver
    extends Object
    implements ErrorHandler, com.sun.tools.xjc.api.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 this 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.

    Author:
    Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com), Vivek Pandey
    • Constructor Detail

      • ErrorReceiver

        public ErrorReceiver()
    • Method Detail

      • error

        public final void error​(Locator loc,
                                String msg)
        Parameters:
        loc - can be null if the location is unknown
      • warning

        public final void warning​(@Nullable
                                  Locator loc,
                                  String msg)
        Reports a warning.
      • 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​(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.tools.xjc.api.ErrorListener
        Specified by:
        info in interface com.sun.xml.bind.api.ErrorListener