diff options
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java')
-rw-r--r-- | velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java index 37eaf19e..f57d2d1c 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java @@ -184,7 +184,7 @@ public class ASTIdentifier extends SimpleNode { String msg = "ASTIdentifier.execute() : identifier = "+identifier; log.error(msg, e); - throw new VelocityException(msg, e); + throw new VelocityException(msg, e, rsvc.getLogContext().getStackTrace()); } /* @@ -196,7 +196,8 @@ public class ASTIdentifier extends SimpleNode if (strictRef) { throw new MethodInvocationException("Object '" + o.getClass().getName() + - "' does not contain property '" + identifier + "'", null, identifier, + "' does not contain property '" + identifier + "'", + null, rsvc.getLogContext().getStackTrace(), identifier, uberInfo.getTemplateName(), uberInfo.getLine(), uberInfo.getColumn()); } else @@ -240,7 +241,7 @@ public class ASTIdentifier extends SimpleNode + " in " + o.getClass() + " threw exception " + ite.getTargetException().toString(), - ite.getTargetException(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn()); + ite.getTargetException(), rsvc.getLogContext().getStackTrace(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn()); } } else @@ -254,7 +255,7 @@ public class ASTIdentifier extends SimpleNode + " in " + o.getClass() + " threw exception " + ite.getTargetException().toString(), - ite.getTargetException(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn()); + ite.getTargetException(), rsvc.getLogContext().getStackTrace(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn()); } @@ -276,7 +277,7 @@ public class ASTIdentifier extends SimpleNode + "for identifier '" + identifier + "' in " + o.getClass(); log.error(msg, e); - throw new VelocityException(msg, e); + throw new VelocityException(msg, e, rsvc.getLogContext().getStackTrace()); } } finally @@ -284,4 +285,19 @@ public class ASTIdentifier extends SimpleNode rsvc.getLogContext().popLogContext(); } } + + /** + * Returns the string ".<i>identifier</i>". This method is only used for displaying the VTL stacktrace + * when a rendering error is encountered when runtime.log.track_location is true. + * @return + */ + @Override + public String literal() + { + if (literal != null) + { + return literal; + } + return literal = '.' + getIdentifier(); + } } |