Class TemplateParseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.apache.velocity.runtime.parser.ParseException
-
- org.apache.velocity.runtime.parser.TemplateParseException
-
- All Implemented Interfaces:
java.io.Serializable
,ExtendedParseException
public class TemplateParseException extends ParseException implements ExtendedParseException
This is an extension of the ParseException, which also takes a template name.- Since:
- 1.5
- Version:
- $Id: TemplateParseException.java 703544 2008-10-10 18:15:53Z nbubna $
- See Also:
ParseException
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
private java.lang.String
templateName
This is the name of the template which contains the parsing error, or null if not defined.-
Fields inherited from class org.apache.velocity.runtime.parser.ParseException
currentToken, eol, expectedTokenSequences, specialConstructor, tokenImage
-
-
Constructor Summary
Constructors Constructor Description TemplateParseException()
The following constructors are for use by you for whatever purpose you can think of.TemplateParseException(java.lang.String message)
Creates a new TemplateParseException object.TemplateParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, java.lang.String[] tokenImageVal)
This constructor is used by the method "generateParseException" in the generated parser.TemplateParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, java.lang.String[] tokenImageVal, java.lang.String templateNameVal)
This constructor is used to add a template name to info cribbed from a ParseException generated in the parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendTemplateInfo(java.lang.StringBuffer sb)
int
getColumnNumber()
returns the column number where this exception occured.int
getLineNumber()
returns the line number where this exception occured.java.lang.String
getMessage()
This method has the standard behavior when this object has been created using the standard constructors.java.lang.String
getTemplateName()
returns the Template name where this exception occured.-
Methods inherited from class org.apache.velocity.runtime.parser.ParseException
add_escapes
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
templateName
private final java.lang.String templateName
This is the name of the template which contains the parsing error, or null if not defined.
-
-
Constructor Detail
-
TemplateParseException
public TemplateParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, java.lang.String[] tokenImageVal, java.lang.String templateNameVal)
This constructor is used to add a template name to info cribbed from a ParseException generated in the parser.- Parameters:
currentTokenVal
-expectedTokenSequencesVal
-tokenImageVal
-templateNameVal
-
-
TemplateParseException
public TemplateParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, java.lang.String[] tokenImageVal)
This constructor is used by the method "generateParseException" in the generated parser. Calling this constructor generates a new object of this type with the fields "currentToken", "expectedTokenSequences", and "tokenImage" set. The boolean flag "specialConstructor" is also set to true to indicate that this constructor was used to create this object. This constructor calls its super class with the empty string to force the "toString" method of parent class "Throwable" to print the error message in the form: ParseException:- Parameters:
currentTokenVal
-expectedTokenSequencesVal
-tokenImageVal
-
-
TemplateParseException
public TemplateParseException()
The following constructors are for use by you for whatever purpose you can think of. Constructing the exception in this manner makes the exception behave in the normal way - i.e., as documented in the class "Throwable". The fields "errorToken", "expectedTokenSequences", and "tokenImage" do not contain relevant information. The JavaCC generated code does not use these constructors.
-
TemplateParseException
public TemplateParseException(java.lang.String message)
Creates a new TemplateParseException object.- Parameters:
message
- TODO: DOCUMENT ME!
-
-
Method Detail
-
getTemplateName
public java.lang.String getTemplateName()
returns the Template name where this exception occured.- Specified by:
getTemplateName
in interfaceExtendedParseException
- Returns:
- The Template name where this exception occured.
-
getLineNumber
public int getLineNumber()
returns the line number where this exception occured.- Specified by:
getLineNumber
in interfaceExtendedParseException
- Returns:
- The line number where this exception occured.
-
getColumnNumber
public int getColumnNumber()
returns the column number where this exception occured.- Specified by:
getColumnNumber
in interfaceExtendedParseException
- Returns:
- The column number where this exception occured.
-
getMessage
public java.lang.String getMessage()
This method has the standard behavior when this object has been created using the standard constructors. Otherwise, it uses "currentToken" and "expectedTokenSequences" to generate a parse error message and returns it. If this object has been created due to a parse error, and you do not catch it (it gets thrown from the parser), then this method is called during the printing of the final stack trace, and hence the correct error message gets displayed.- Overrides:
getMessage
in classParseException
- Returns:
- The error message.
-
appendTemplateInfo
protected void appendTemplateInfo(java.lang.StringBuffer sb)
- Parameters:
sb
-
-
-