Mantis - Hessian
Viewing Issue Advanced Details
3356 major always 02-25-09 02:57 06-29-09 09:20
Peter Dettman  
 
normal  
closed 3.2.1  
fixed  
none    
none 4.0.0  
0003356: NPE calling no-arg method via HessianProxy (Hessian 2)
To reproduce, just use a HessianProxyFactory to create a proxy for an interface containing at least one no-arg method.

e.g.
HessianProxyFactory factory = new HessianProxyFactory();
factory.setHessian2Request(true);

Runnable runnable = (Runnable)factory.create(Runnable.class, URL);
runnable.run(); // NPE


This appears to have entered as of r4587.

The fix is straight-forward: Hessian2Output.call(String, Object[]) should use the local variable 'length' in the for-loop condition in place of 'args.length' (the same way it's done in HessianOutput.call).
Relevant part of stack trace:
java.lang.NullPointerException
    at com.caucho.hessian.io.Hessian2Output.call(Hessian2Output.java:136)
    at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:333)
    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:166)
    at $Proxy7.open(Unknown Source)
 hessian_0003356.patch [^] (375 bytes) 02-27-09 02:28

Notes
(0004070)
sphemy   
06-09-09 00:49   
how to add the patch to hessian-3.2.1.jar?
(0004089)
emil   
06-29-09 09:20   
hessian/3400, et al.