You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2009/01/22 12:59:36 UTC

svn commit: r736614 - in /velocity/engine/trunk/src/java/org/apache/velocity/runtime: VelocimacroManager.java directive/VelocimacroProxy.java

Author: byron
Date: Thu Jan 22 03:59:35 2009
New Revision: 736614

URL: http://svn.apache.org/viewvc?rev=736614&view=rev
Log:
Added location to error reporting when exceeding max macro call level

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java?rev=736614&r1=736613&r2=736614&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java Thu Jan 22 03:59:35 2009
@@ -468,6 +468,7 @@
             vp.setName(this.vmName);
             vp.setArgArray(this.argArray);
             vp.setNodeTree(this.nodeTree);
+            vp.setLocation(macro.getLine(), macro.getColumn(), macro.getTemplateName());
             vp.init(rsvc);
         }
         

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=736614&r1=736613&r2=736614&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Thu Jan 22 03:59:35 2009
@@ -31,6 +31,7 @@
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.log.Log;
 import org.apache.velocity.runtime.parser.ParserTreeConstants;
 import org.apache.velocity.runtime.parser.node.ASTDirective;
 import org.apache.velocity.runtime.parser.node.Node;
@@ -199,20 +200,16 @@
                 }
                 out.append(stack[i]);
             }
+            out.append(" at " + Log.formatFileString(this));
             rsvc.getLog().error(out.toString());
-
-            try
-            {
-                throw new MacroOverflowException(out.toString());
-            }
-            finally
+            
+            // clean out the macro stack, since we just broke it
+            while (vmc.getCurrentMacroCallDepth() > 0)
             {
-                // clean out the macro stack, since we just broke it
-                while (vmc.getCurrentMacroCallDepth() > 0)
-                {
-                    vmc.popCurrentMacroName();
-                }
+                vmc.popCurrentMacroName();
             }
+
+            throw new MacroOverflowException(out.toString());
         }
 
         try