Uploaded image for project: 'jsonrpc'
  1. jsonrpc
  2. JSONRPC-16

Failed to match correct method overload

    XMLWordPrintable

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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rkosegi Richard Kosegi
            rkosegi Richard Kosegi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: