org.hackystat.telemetry.analyzer.language.parser
Class ParsingException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.hackystat.telemetry.analyzer.language.TelemetryLanguageException
              extended by org.hackystat.telemetry.analyzer.language.parser.ParsingException
All Implemented Interfaces:
java.io.Serializable

public class ParsingException
extends TelemetryLanguageException

Exception for telemetry query parsing related problems.

Version:
$Id$
Author:
(Cedric) Qin Zhang
See Also:
Serialized Form

Constructor Summary
ParsingException(java.lang.String message)
          Constructs this parsing exception.
ParsingException(java.lang.String message, int errorLineNumber, int errorColumnNumber)
          Constructs this parsing exception.
ParsingException(java.lang.Throwable exception)
          Constructs this parsing exception.
 
Method Summary
 int getErrorColumnNumber()
          Gets the column number (1-indexed) where the parser encounters the error.
 int getErrorLineNumber()
          Gets the line number (1-indexed) where the parser encounters the error.
 
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(java.lang.String message)
Constructs this parsing exception. Only use this constructor if you don't know where the parser encounters the error.

Parameters:
message - The error message.

ParsingException

public ParsingException(java.lang.String message,
                        int errorLineNumber,
                        int errorColumnNumber)
Constructs this parsing exception.

Parameters:
message - The error message.
errorLineNumber - The line (1-indexed) where the parser encounters the error.
errorColumnNumber - The column (1-indexed) where the parser encounters the error.

ParsingException

public ParsingException(java.lang.Throwable exception)
Constructs this parsing exception.

Important: If the exception passed in is of type ParseException, then there is special logic to extract error line number and column number. This works with the ParseException code generated with JavaCC 3.1. I am not sure whether it will work correctly with other versions of JavaCC, since it uses some internal knowledge of the parser to get the line number and column number where the parse error occurs.

Parameters:
exception - The exception to be wrapped.
Method Detail

getErrorLineNumber

public int getErrorLineNumber()
Gets the line number (1-indexed) where the parser encounters the error.

Returns:
The line number, or a non-positive number indication such information is not available.

getErrorColumnNumber

public int getErrorColumnNumber()
Gets the column number (1-indexed) where the parser encounters the error.

Returns:
The column number, or a non-positive number indication such information is not available.