Package ptolemy.moml

Class StreamErrorHandler

  • All Implemented Interfaces:
    ErrorHandler

    public class StreamErrorHandler
    extends java.lang.Object
    implements ErrorHandler
    Basic error handler for the MoMLParser class. This error handler reports errors to a stream or to standard error, and requests that parsing continue.
    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    MoMLParser
    Pt.AcceptedRating:
    Red (reviewmoderator)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Summary

      Constructors 
      Constructor Description
      StreamErrorHandler()
      Create an error handler that sends messages to the standard error.
      StreamErrorHandler​(java.io.OutputStream out)
      Create an error handler that sends messages to the specified stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void enableErrorSkipping​(boolean enable)
      Enable or disable skipping of errors.
      int handleError​(java.lang.String element, NamedObj context, java.lang.Throwable exception)
      Handle an error by printing a description of the error to the stream specified in the constructor.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StreamErrorHandler

        public StreamErrorHandler()
        Create an error handler that sends messages to the standard error.
      • StreamErrorHandler

        public StreamErrorHandler​(java.io.OutputStream out)
        Create an error handler that sends messages to the specified stream.
        Parameters:
        out - The OutputStream
    • Method Detail

      • enableErrorSkipping

        public void enableErrorSkipping​(boolean enable)
        Enable or disable skipping of errors. This method does nothing.
        Specified by:
        enableErrorSkipping in interface ErrorHandler
        Parameters:
        enable - True to enable skipping, false to disable.
      • handleError

        public int handleError​(java.lang.String element,
                               NamedObj context,
                               java.lang.Throwable exception)
        Handle an error by printing a description of the error to the stream specified in the constructor.
        Specified by:
        handleError in interface ErrorHandler
        Parameters:
        element - The XML element that triggered the error.
        context - The container object for the element.
        exception - The exception that was thrown.
        Returns:
        CONTINUE to request skipping this element.