diff options
author | Claude Brisson <cbrisson@apache.org> | 2022-06-18 08:57:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-18 08:57:53 +0200 |
commit | 0f60a250f3454b477f5ae3532ba62219e62cc70c (patch) | |
tree | 6cdc7925942fdfd429d61a11428ce83489489f48 | |
parent | b34519bf94881109f75bfac652f9ec14498c0ddb (diff) | |
parent | 5869860fb224c9443d8505aa126332bde2c965df (diff) | |
download | apache-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.java | 9 |
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; } /** |