Class ParserException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ParserException
    extends java.lang.Exception
    Exception thrown when an error occurs in document parsing. It may optionally include the following fields:
       Locator (file name, URL, etc.)
       Line number (negative for unknown)
       The text of the actual offending line (Null if unknown)
       Character offset (negative for unknown)
     
    Author:
    Matthew Pocock, Greg Cox
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ParserException​(java.lang.String detail)  
      ParserException​(java.lang.String detail, java.lang.String locator)  
      ParserException​(java.lang.String detail, java.lang.String locator, int line)  
      ParserException​(java.lang.String detail, java.lang.String locator, int lineNumber, java.lang.String line)  
      ParserException​(java.lang.String detail, java.lang.String locator, int lineNumber, java.lang.String line, int character)  
      ParserException​(java.lang.String message, java.lang.Throwable cause)  
      ParserException​(java.lang.Throwable t)  
      ParserException​(java.lang.Throwable t, java.lang.String detail)
      Deprecated.
      use new ParserException(detail, t)
      ParserException​(java.lang.Throwable t, java.lang.String detail, java.lang.String locator)  
      ParserException​(java.lang.Throwable t, java.lang.String detail, java.lang.String locator, int line)  
      ParserException​(java.lang.Throwable t, java.lang.String detail, java.lang.String locator, int lineNumber, java.lang.String line)  
      ParserException​(java.lang.Throwable t, java.lang.String detail, java.lang.String locator, int lineNumber, java.lang.String line, int character)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCharacterOffset()
      Get the character offset in the line where an error was detected.
      java.lang.String getLine()
      Get the text of the line where the exception occured.
      int getLineNumber()
      Get the line number in the stream where this exception occured.
      java.lang.String getLocator()
      Get a locator for the stream which caused this exception.
      java.lang.String toString()
      Represent this exception as a string.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
      • Methods inherited from class java.lang.Object

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

      • ParserException

        public ParserException​(java.lang.String detail)
      • ParserException

        public ParserException​(java.lang.String detail,
                               java.lang.String locator)
      • ParserException

        public ParserException​(java.lang.String detail,
                               java.lang.String locator,
                               int line)
      • ParserException

        public ParserException​(java.lang.String detail,
                               java.lang.String locator,
                               int lineNumber,
                               java.lang.String line)
      • ParserException

        public ParserException​(java.lang.String detail,
                               java.lang.String locator,
                               int lineNumber,
                               java.lang.String line,
                               int character)
      • ParserException

        public ParserException​(java.lang.Throwable t)
      • ParserException

        public ParserException​(java.lang.Throwable t,
                               java.lang.String detail)
        Deprecated.
        use new ParserException(detail, t)
      • ParserException

        public ParserException​(java.lang.String message,
                               java.lang.Throwable cause)
      • ParserException

        public ParserException​(java.lang.Throwable t,
                               java.lang.String detail,
                               java.lang.String locator)
      • ParserException

        public ParserException​(java.lang.Throwable t,
                               java.lang.String detail,
                               java.lang.String locator,
                               int line)
      • ParserException

        public ParserException​(java.lang.Throwable t,
                               java.lang.String detail,
                               java.lang.String locator,
                               int lineNumber,
                               java.lang.String line)
      • ParserException

        public ParserException​(java.lang.Throwable t,
                               java.lang.String detail,
                               java.lang.String locator,
                               int lineNumber,
                               java.lang.String line,
                               int character)
    • Method Detail

      • getLocator

        public java.lang.String getLocator()
        Get a locator for the stream which caused this exception.
        Returns:
        A locator string, or null if none is known.
      • getLineNumber

        public int getLineNumber()
        Get the line number in the stream where this exception occured.
        Returns:
        A positive integer line number, or -1 if not known.
      • getCharacterOffset

        public int getCharacterOffset()
        Get the character offset in the line where an error was detected.
        Returns:
        The first character in the line where the parser detected an error, or -1 if the exception effects the whole line.
      • getLine

        public java.lang.String getLine()
        Get the text of the line where the exception occured.
        Returns:
        The text of the line, or null if not known.
      • toString

        public java.lang.String toString()
        Represent this exception as a string. This includes the default exception toString representation, followed by details of the location where the error occured, if they were supplied when constructing this exception.
        Overrides:
        toString in class java.lang.Throwable
        Returns:
        A string representation of this exception.