[JSONRPC-16] Failed to match correct method overload Created: 05/Mar/18  Updated: 10/Mar/18  Resolved: 10/Mar/18

Status: Resolved
Project: jsonrpc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Richard Kosegi Assignee: Richard Kosegi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by Richard Kosegi [ 05/Mar/18 ]

Proposed fix https://git.opendaylight.org/gerrit/#/c/69055/

Generated at Wed Feb 07 20:05:18 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.