net.sf.japaki.text
Class ParsingException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.text.ParseException
              extended by net.sf.japaki.text.ParsingException
All Implemented Interfaces:
Serializable, Comparable<ParsingException>

public class ParsingException
extends ParseException
implements Comparable<ParsingException>

An exception that stores the path to the field where the parsing exception occurred.

See Also:
ParseReader.checkForException(java.lang.String), Serialized Form

Constructor Summary
ParsingException(String s, int errorOffset, int errorLine, String source, Collection<Parser> path)
          Constructs a parsing exception with the specified details.
 
Method Summary
 int compareTo(ParsingException other)
          Compares the error position of this exception with the position of the specified exception.
 int getErrorLine()
          Returns the number of the line where the error was found.
 Collection<Parser> getPath()
          Returns the path to the field where the parsing exception occurred.
 String getSource()
          Returns the line where the error was found.
 void printDetails()
          Performs the default way to display a parsing exception.
 void printDetails(PrintStream stream)
          Performs the default way to display a parsing exception.
 
Methods inherited from class java.text.ParseException
getErrorOffset
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParsingException

public ParsingException(String s,
                        int errorOffset,
                        int errorLine,
                        String source,
                        Collection<Parser> path)
Constructs a parsing exception with the specified details.

Parameters:
s - the detail message
errorOffset - the position where the error is found while parsing
errorLine - the line where the exception is found
path - path to the field where the exception is found
Method Detail

getErrorLine

public int getErrorLine()
Returns the number of the line where the error was found.

Returns:
the number of the line where the error was found

getSource

public String getSource()
Returns the line where the error was found.

Returns:
the line where the error was found

getPath

public Collection<Parser> getPath()
Returns the path to the field where the parsing exception occurred.

Returns:
the path to the field where the parsing exception occurred

printDetails

public void printDetails(PrintStream stream)
Performs the default way to display a parsing exception.

Parameters:
stream - PrintStream to use for output

printDetails

public void printDetails()
Performs the default way to display a parsing exception. The exception's details are printed to System.err.


compareTo

public int compareTo(ParsingException other)
Compares the error position of this exception with the position of the specified exception.

Specified by:
compareTo in interface Comparable<ParsingException>