nu.xom
Class ParsingException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bynu.xom.ParsingException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ValidityException

public class ParsingException
extends java.lang.Exception

This is 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.0d23
Author:
Elliotte Rusty Harold
See Also:
Serialized Form

Constructor Summary
ParsingException(java.lang.String message)
           Creates a new ParsingException with a detail message.
ParsingException(java.lang.String message, int lineNumber, int columnNumber)
           Creates a new ParsingException with a detail message and line and column numbers.
ParsingException(java.lang.String message, int lineNumber, int columnNumber, java.lang.Throwable ex)
           Creates a new ParsingException with a detail message, line and column numbers, and an underlying exception.
ParsingException(java.lang.String message, java.lang.Throwable ex)
           Creates a new ParsingException with a detail message and an underlying root cause.
 
Method Summary
 java.lang.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.
 java.lang.Throwable initCause(java.lang.Throwable cause)
           Sets the root cause of this exception.
 java.lang.String toString()
           Returns a string suitable for display to the developer summarizing what went wrong where.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, 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(java.lang.String message,
                        java.lang.Throwable ex)

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

Parameters:
message - indicates the specific problem
ex - the original cause of this exception

ParsingException

public ParsingException(java.lang.String message,
                        int lineNumber,
                        int columnNumber)

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

Parameters:
message - indicates the specific problem
lineNumber - the approximate line number where the problem occurs
columnNumber - the approximate column number where the problem occurs

ParsingException

public ParsingException(java.lang.String message,
                        int lineNumber,
                        int columnNumber,
                        java.lang.Throwable ex)

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

Parameters:
message - indicates the specific problem
lineNumber - the approximate line number where the problem occurs
columnNumber - the approximate column number where the problem occurs
ex - the original cause of this exception

ParsingException

public ParsingException(java.lang.String message)

Creates a new ParsingException with a detail message.

Parameters:
message - indicates 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

initCause

public java.lang.Throwable initCause(java.lang.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.

Parameters:
cause - the root cause of this exception
Returns:
this XMLException
Throws:
java.lang.IllegalArgumentException - if the cause is this exception (An exception cannot be its own cause.)
java.lang.IllegalStateException - if this method is called twice

getCause

public java.lang.Throwable getCause()

Returns the underlying exception that caused this exception.

Returns:
the root exception that caused this exception to be thrown

toString

public java.lang.String toString()

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

Returns:
an exception message suitable for display to a developer
See Also:
Object.toString()


Copyright 2002-2004 Elliotte Rusty Harold
elharo@metalab.unc.edu