aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2022-06-18 08:57:53 +0200
committerGitHub <noreply@github.com>2022-06-18 08:57:53 +0200
commit0f60a250f3454b477f5ae3532ba62219e62cc70c (patch)
tree6cdc7925942fdfd429d61a11428ce83489489f48
parentb34519bf94881109f75bfac652f9ec14498c0ddb (diff)
parent5869860fb224c9443d8505aa126332bde2c965df (diff)
downloadapache-velocity-engine-0f60a250f3454b477f5ae3532ba62219e62cc70c.tar.gz
Merge pull request #29 from DoItWithASmile/master
Fixes VELOCITY-953
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
index 0cad8a43..d3b8ff5c 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
@@ -216,8 +216,6 @@ public class VelocimacroProxy extends Directive
// render the velocity macro
context.pushCurrentMacroName(macroName);
nodeTree.render(context, writer);
- context.popCurrentMacroName();
- return true;
}
catch (RuntimeException e)
{
@@ -231,6 +229,11 @@ public class VelocimacroProxy extends Directive
}
finally
{
+ // if MacroOverflowException was thrown then it already empties the stack
+ // for everything else - e.g. other exceptions - we clean up after ourself
+ if (context.getCurrentMacroCallDepth() > 0)
+ context.popCurrentMacroName();
+
// clean up after the args and bodyRef
// but only if they weren't overridden inside
Object current = context.get(bodyReference);
@@ -283,6 +286,8 @@ public class VelocimacroProxy extends Directive
}
}
}
+
+ return true;
}
/**