You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@locus.apache.org on 2000/12/05 06:00:51 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser Parser.jjt

geirm       00/12/04 21:00:50

  Modified:    src/java/org/apache/velocity/runtime/parser Parser.jjt
  Log:
  Added support for template name to be part of log entry in case of parser error.
  
  Revision  Changes    Path
  1.36      +7 -4      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt
  
  Index: Parser.jjt
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- Parser.jjt	2000/11/30 08:14:25	1.35
  +++ Parser.jjt	2000/12/05 05:00:49	1.36
  @@ -120,7 +120,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: Parser.jjt,v 1.35 2000/11/30 08:14:25 jvanzyl Exp $ 
  + * @version $Id: Parser.jjt,v 1.36 2000/12/05 05:00:49 geirm Exp $ 
   */
   public class Parser
   {
  @@ -150,9 +150,10 @@
        * method and re-initializing the lexer with
        * the new stream that we want parsed.
        */
  -    public SimpleNode parse(InputStream stream) throws ParseException
  +    public SimpleNode parse(InputStream stream, String strTemplateName ) throws ParseException
       {
           SimpleNode sn = null;
  +
           try
           {
               token_source.clearStateVars();
  @@ -161,16 +162,18 @@
           }
           catch (ParseException pe)
           {
  -            Runtime.error ("Parser Exception: " + StringUtils.stackTrace(pe));
  +            Runtime.error ("Parser Exception: " + strTemplateName + " : " + StringUtils.stackTrace(pe));
               throw new ParseException (pe.currentToken, 
                   pe.expectedTokenSequences, pe.tokenImage);
           }
           catch (Exception e)
           {
  -            Runtime.error ("Parser Error: " + StringUtils.stackTrace(e));
  +            Runtime.error ("Parser Error: " + strTemplateName + " : " + StringUtils.stackTrace(e));
           }
  +
           return sn;
       }        
  +
       /**
        *  This method sets the directives Hashtable
        */