Package nu.xom

Class ParsingException

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ValidityException

    public class ParsingException
    extends Exception

    The generic superclass for all the checked exceptions thrown in XOM. The general principle followed is that anything that could plausibly be detected by testing such as using spaces in an element name is a runtime exception. Exceptions that depend on environmental conditions, such as might occur when parsing an external file, are checked exceptions, because these depend on variable input, and thus problems may not all be detected during testing.

    Version:
    1.1b3
    Author:
    Elliotte Rusty Harold
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ParsingException​(String message)
      Creates a new ParsingException with a detail message.
      ParsingException​(String message, int lineNumber, int columnNumber)
      Creates a new ParsingException with a detail message and line and column numbers.
      ParsingException​(String message, int lineNumber, int columnNumber, Throwable cause)
      Creates a new ParsingException with a detail message, line and column numbers, and an underlying exception.
      ParsingException​(String message, String uri, int lineNumber, int columnNumber)
      Creates a new ParsingException with a detail message and line and column numbers.
      ParsingException​(String message, String uri, int lineNumber, int columnNumber, Throwable cause)
      Creates a new ParsingException with a detail message, line and column numbers, and an underlying exception.
      ParsingException​(String message, String uri, Throwable cause)
      Creates a new ParsingException with a detail message and an underlying root cause.
      ParsingException​(String message, Throwable cause)
      Creates a new ParsingException with a detail message and an underlying root cause.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Throwable getCause()
      Returns the underlying exception that caused this exception.
      int getColumnNumber()
      Returns the approximate column number of the construct that caused this exception.
      int getLineNumber()
      Returns the approximate row number of the construct that caused this exception.
      String getURI()
      Returns the system ID (generally a URL) of the document that caused this exception.
      Throwable initCause​(Throwable cause)
      Sets the root cause of this exception.
      String toString()
      Returns a string suitable for display to the developer summarizing what went wrong where.
      • Methods inherited from class java.lang.Throwable

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

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

      • ParsingException

        public ParsingException​(String message,
                                Throwable cause)

        Creates a new ParsingException with a detail message and an underlying root cause.

        Parameters:
        message - a string indicating the specific problem
        cause - the original cause of this exception
      • ParsingException

        public ParsingException​(String message,
                                String uri,
                                Throwable cause)

        Creates a new ParsingException with a detail message and an underlying root cause.

        Parameters:
        message - a string indicating the specific problem
        uri - the URI of the document that caused this exception
        cause - the original cause of this exception
      • ParsingException

        public ParsingException​(String message,
                                int lineNumber,
                                int columnNumber)

        Creates a new ParsingException with a detail message and line and column numbers.

        Parameters:
        message - a string indicating the specific problem
        lineNumber - the approximate line number where the problem occurs
        columnNumber - the approximate column number where the problem occurs
      • ParsingException

        public ParsingException​(String message,
                                String uri,
                                int lineNumber,
                                int columnNumber)

        Creates a new ParsingException with a detail message and line and column numbers.

        Parameters:
        message - a string indicating the specific problem
        uri - the URI of the document that caused this exception
        lineNumber - the approximate line number where the problem occurs
        columnNumber - the approximate column number where the problem occurs
      • ParsingException

        public ParsingException​(String message,
                                String uri,
                                int lineNumber,
                                int columnNumber,
                                Throwable cause)

        Creates a new ParsingException with a detail message, line and column numbers, and an underlying exception.

        Parameters:
        message - a string indicating the specific problem
        uri - the URI of the document that caused this exception
        lineNumber - the approximate line number where the problem occurs
        columnNumber - the approximate column number where the problem occurs
        cause - the original cause of this exception
      • ParsingException

        public ParsingException​(String message,
                                int lineNumber,
                                int columnNumber,
                                Throwable cause)

        Creates a new ParsingException with a detail message, line and column numbers, and an underlying exception.

        Parameters:
        message - a string indicating the specific problem
        lineNumber - the approximate line number where the problem occurs
        columnNumber - the approximate column number where the problem occurs
        cause - the original cause of this exception
      • ParsingException

        public ParsingException​(String message)

        Creates a new ParsingException with a detail message.

        Parameters:
        message - a string indicating the specific problem
    • Method Detail

      • getLineNumber

        public int getLineNumber()

        Returns the approximate row number of the construct that caused this exception. If the row number is not known, -1 is returned.

        Returns:
        row number where the exception occurred
      • getColumnNumber

        public int getColumnNumber()

        Returns the approximate column number of the construct that caused this exception. If the column number is not known, -1 is returned.

        Returns:
        column number where the exception occurred
      • getURI

        public String getURI()

        Returns the system ID (generally a URL) of the document that caused this exception. If this is not known, for instance because the document was parsed from a raw input stream or from a string, it returns null.

        Returns:
        the URI of the document that caused this exception
      • initCause

        public final Throwable initCause​(Throwable cause)

        Sets the root cause of this exception. This may only be called once. Subsequent calls throw an IllegalStateException.

        This method is unnecessary in Java 1.4 where it could easily be inherited from the superclass. However, including it here allows this method to be used in Java 1.3 and earlier.

        Overrides:
        initCause in class Throwable
        Parameters:
        cause - the root cause of this exception
        Returns:
        this XMLException
        Throws:
        IllegalArgumentException - if the cause is this exception (An exception cannot be its own cause.)
        IllegalStateException - if this method is called twice
      • getCause

        public Throwable getCause()

        Returns the underlying exception that caused this exception.

        Overrides:
        getCause in class Throwable
        Returns:
        the root exception that caused this exception to be thrown
      • toString

        public String toString()

        Returns a string suitable for display to the developer summarizing what went wrong where.

        Overrides:
        toString in class Throwable
        Returns:
        an exception message suitable for display to a developer