aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2019-03-03 11:31:43 +0000
committerClaude Brisson <cbrisson@apache.org>2019-03-03 11:31:43 +0000
commit8db2127aa06fa204a2be8a8baa7e362c7bd85783 (patch)
tree616fa95c8fa53d6db9e3ef4ed7e6086a7ca14a79 /velocity-engine-core/src/main/java/org/apache
parent9468c7cc024a114ba3efb96e4d9dcdc57df4608f (diff)
downloadapache-velocity-engine-8db2127aa06fa204a2be8a8baa7e362c7bd85783.tar.gz
[engine] Invalid method calls should definitely be logged
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1854695 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
index 403cd28a..c046b618 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
@@ -165,6 +165,20 @@ public class ASTMethod extends SimpleNode
VelMethod method = ClassUtils.getMethod(methodName, params, paramClasses,
o, context, this, strictRef);
+ // warn if method wasn't found (if strictRef is true, then ClassUtils did thorw an exception)
+ if (o != null && method == null)
+ {
+ StringBuilder plist = new StringBuilder();
+ for (int i = 0; i < params.length; i++)
+ {
+ Class param = paramClasses[i];
+ plist.append(param == null ? "null" : param.getName());
+ if (i < params.length - 1)
+ plist.append(", ");
+ }
+ log.warn("Object '{}' does not contain method {}({}) at {}[line {}, column {}]", o.getClass().getName(), methodName, plist, getTemplateName(), getLine(), getColumn());
+ }
+
/*
* The parent class (typically ASTReference) uses the icache entry
* under 'this' key to distinguish a valid null result from a non-existent method.