dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

Telnet does not support invoke a method of set parameter

Open JoneWeng opened this issue 8 years ago • 4 comments

  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.
  • [ x ] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: latest
  • Operating System version: mac
  • Java version: 1.8

Steps to reproduce this issue

public interface DemoService {
    
    int getListSize(List list);
    int getSetSize(Set set);
    
}
  1. telnet localhost 20881
  2. invoke xxx.getListSize([1,2,3])
  3. invoke xxx.getSetSize([1,2,3])

Expected Result

  1. ok
  2. ok

Actual Result

  1. ok
  2. No such method

JoneWeng avatar Nov 28 '18 08:11 JoneWeng

may this pr #2801 can solve you problem.

kexianjun avatar Nov 28 '18 09:11 kexianjun

no, did not resolve this problem

JoneWeng avatar Nov 28 '18 09:11 JoneWeng

the cause of the problem: org.apache.dubbo.rpc.protocol.dubbo.telnet.InvokeTelnetHandler#isMatch

// arg(JSONArray instance) is Assignable From List
// Set not match
else if (arg instanceof Collection) {
        if (!type.isArray() && !type.isAssignableFrom(arg.getClass())) {
            return false;
        }
}

actually, PojoUtils#realize can convert JSONArray to Set

JoneWeng avatar Nov 28 '18 09:11 JoneWeng

invoke DemoService.getSetSize(Set[1,2,3])

zonghaishang avatar Nov 28 '18 09:11 zonghaishang