Details
-
Bug
-
Status: Resolved
-
Medium
-
Resolution: Done
-
None
-
None
-
None
-
None
Description
When there are multiple methods with same name and number of arguments, designed approach is to try them all and return first result where invocation succeeded.
However, this is not implemented correctly:
org.opendaylight.jsonrpc.bus.messagelib.ThreadedSessionImpl line ~225
for (final Method m : opt) { try { Object[] args = getArgumentsForMethod(m, message); return m.invoke(handler, args); } catch (JsonRpcException e) { String msg = String.format("Failed to manage arguments when invoking method %s", m); LOG.debug(msg); throw new IllegalArgumentException(msg, e); } }
When first method candidate throws JsonRpcException, loop is immediately exited without trying another candidate which might succeed.
There are 2 possible ways how method candidate can fail:
- by choosing inappropriate candidate (wrong arguments)
- by execution of candidate method itself (throwing exception from method body)
Splitting invocation into 2 steps allows to identify more accurately real problem when multiple method candidates are tried in a row.