commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Pitts (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OGNL-41) OgnlRuntime.getMethod fails to return correct method in some circumstances.
Date Mon, 21 Nov 2011 18:44:52 GMT
OgnlRuntime.getMethod fails to return correct method in some circumstances.
---------------------------------------------------------------------------

                 Key: OGNL-41
                 URL: https://issues.apache.org/jira/browse/OGNL-41
             Project: OGNL
          Issue Type: Bug
            Reporter: Daniel Pitts


OgnlRuntime.getMethod fails to return correct method in some circumstances, causing the wrong
method to be called in "compiled" expressions.

The test case class is "Messages", which has a few "format" methods.  When attempting to call
message.format("SomeString", one), OgnlRuntime.getMethod returns null, instead of finding
"format(String, Object)".

The problem is partially masked by the next call in ASTMethod: "OgnlRuntime.getReadMethod",
which returns the "format(String, Object[])" method.

In the unit tests, MethodTest[3] is the one that is wrong. The expected result should be "first",
but is instead "foo". 

When running MethodTest with compilation turned off, "foo" is return as expected.

It looks like the logic in "getAppropriateMethod" is correct, but currently relies on actual
arguments, rather than just argument types.  I think it could be refactored and used for both
the compiled and uncompiled use cases. 

I have no patch at the moment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message