Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.7.3, 3.0
-
None
-
None
-
JDK 1.6 + Groovy 1.7.2
Description
When OgnlRuntime.findClosestMatchingMethod calls getDeclaredMethods on line 2029, it does not check for a null return value from the invocation. When evaluating a nested property on a Groovy object, the "metaClass" property Groovy makes on objects causes getDeclaredMethods to not find a callable method (as determined by isCallableMethod) for that property.
The result is that getDeclaredMethods returns null and the for-loop raises a NPE.
In my test cases, I successfully evaluated an OGNL expression against Groovy objects by emulating what the result of OgnlRuntime.findClosestMatchingMethod would have done had it not raised the NPE. The (admittingly very simple) expression evaluated as expected.