You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Stefan Groschupf <sg...@media-style.com> on 2005/12/27 19:17:34 UTC

[bug?] PRC called emthod require parameter

Hi,
looks like the jira is down.
We already discussed that a NPE is thrown in case the remote method  
does not return any values.
I also note this line in client.java
public Writable[] call(Writable[] params, InetSocketAddress[] addresses)
     throws IOException {
     if (params.length == 0) return new Writable[0];

Do I understand it correct that in case the remote method does not  
need any parameter no remote call is done?
Makes that sense?
Stefan


Re: [bug?] PRC called emthod require parameter

Posted by Doug Cutting <cu...@nutch.org>.
Okay, here's my patch attached.

We don't need an all-new unit test file, when just a few lines are 
needed there.

Does this look right to you?

Doug

Stefan Groschupf wrote:
>> What bug was that?  What is your one-line fix?
> 
> 
> http://www.nabble.com/RCP-known-limitation-or-bug--t688207.html
> 
> something like:
> Object[] values;
> method.getReturnType()!=null ? values  = (Object[])Array.newInstance 
> (method.getReturnType(),wrappedValues.length) : values  = new Object[0];

Re: [bug?] PRC called emthod require parameter

Posted by Stefan Groschupf <sg...@media-style.com>.
> What bug was that?  What is your one-line fix?

http://www.nabble.com/RCP-known-limitation-or-bug--t688207.html

something like:
Object[] values;
method.getReturnType()!=null ? values  = (Object[])Array.newInstance 
(method.getReturnType(),wrappedValues.length) : values  = new Object[0];

Re: [bug?] PRC called emthod require parameter

Posted by Doug Cutting <cu...@nutch.org>.
Stefan Groschupf wrote:
>> Different parameters are sent to each address.  So params.length  
>> should equal addresses.length, and if params.length==0 then  
>> addresses.length==0 and there's no call to be made.  Make sense?   It 
>> might be clearer if the test were changed to addresses.length==0.
> 
> Yes, this would be better, since it would than be  possible to call a  
> set of addresses but not send any parameter (e.g.  'reboot()').
> Should I open a jira issue for that?

No, I just made the change.

> Also what happens with the other rpc bug? I submitted a test that  
> reproduces the error as you had requested. I can fix this,  ... it is  
> just one line....

What bug was that?  What is your one-line fix?

Doug

Re: [bug?] PRC called emthod require parameter

Posted by Stefan Groschupf <sg...@media-style.com>.
> Different parameters are sent to each address.  So params.length  
> should equal addresses.length, and if params.length==0 then  
> addresses.length==0 and there's no call to be made.  Make sense?   
> It might be clearer if the test were changed to addresses.length==0.

Yes, this would be better, since it would than be  possible to call a  
set of addresses but not send any parameter (e.g.  'reboot()').
Should I open a jira issue for that?
Also what happens with the other rpc bug? I submitted a test that  
reproduces the error as you had requested. I can fix this,  ... it is  
just one line....

Thanks.
Stefan 

Re: [bug?] PRC called emthod require parameter

Posted by Doug Cutting <cu...@nutch.org>.
Stefan Groschupf wrote:
> I also note this line in client.java
> public Writable[] call(Writable[] params, InetSocketAddress[] addresses)
>     throws IOException {
>     if (params.length == 0) return new Writable[0];
> 
> Do I understand it correct that in case the remote method does not  need 
> any parameter no remote call is done?

Different parameters are sent to each address.  So params.length should 
equal addresses.length, and if params.length==0 then addresses.length==0 
and there's no call to be made.  Make sense?  It might be clearer if the 
test were changed to addresses.length==0.

Doug