You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/10/13 21:23:29 UTC

svn commit: r704210 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java

Author: nbubna
Date: Mon Oct 13 12:23:29 2008
New Revision: 704210

URL: http://svn.apache.org/viewvc?rev=704210&view=rev
Log:
VELOCITY-628 make sure string literal exception msg contains name/line/col info

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=704210&r1=704209&r2=704210&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Mon Oct 13 12:23:29 2008
@@ -29,6 +29,7 @@
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.log.Log;
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.Parser;
 
@@ -158,17 +159,17 @@
              * Also, do *not* dump the VM namespace for this template
              */
 
+            String templateName =
+                (context != null) ? context.getCurrentTemplateName() : "StringLiteral";
             try
             {
-                nodeTree = rsvc.parse(br, (context != null) ? context
-                        .getCurrentTemplateName() : "StringLiteral", false);
+                nodeTree = rsvc.parse(br, templateName, false);
             }
             catch (ParseException e)
             {
-                throw new TemplateInitException(
-                        "Problem parsing String literal.", e,
-                        (context != null) ? context.getCurrentTemplateName()
-                                : "StringLiteral", getColumn(), getLine());
+                String msg = "Failed to parse String literal at "+
+                    Log.formatFileString(templateName, getLine(), getColumn());
+                throw new TemplateInitException(msg, e, templateName, getColumn(), getLine());
             }
 
             /*