Class ErrorReceiver

java.lang.Object
com.sun.tools.ws.wscompile.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 ([email protected]), Vivek Pandey
  • Constructor Details

    • ErrorReceiver

      public ErrorReceiver()
  • Method Details

    • 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)
    • warning

      public final void warning(@Nullable Locator loc, String msg)
      Reports a warning.
    • error

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

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

      public abstract void warning(SAXParseException exception) throws AbortException
      Specified by:
      warning in interface ErrorHandler
      Specified by:
      warning in interface com.sun.tools.xjc.api.ErrorListener
      Specified by:
      warning in interface com.sun.xml.bind.api.ErrorListener
      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(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
    • debug

      public final void debug(String msg)
      Reports a debug message to users.
      See Also:
    • debug

      public abstract void debug(SAXParseException exception)
    • getLocationString

      protected final String getLocationString(SAXParseException e)
      Returns the human readable string representation of the Locator part of the specified SAXParseException.
      Returns:
      non-null valid object.