Mantis - Hessian
Viewing Issue Advanced Details
2878 minor always 08-28-08 14:24 09-11-08 15:50
ferg  
ferg  
normal  
closed  
fixed  
none    
none 3.2.1  
0002878: Hessian proxy equals
(rep by Christian Campo)

just today I fell across a piece of code in Hessian that I dont quite get. Its in the HessianProxy line 103ff

  public Object invoke(Object proxy, Method method, Object []args)
    throws Throwable
  {
    String mangleName;

    synchronized (_mangleMap) {
      mangleName = _mangleMap.get(method);
    }

    if (mangleName == null) {
      String methodName = method.getName();
      Class []params = method.getParameterTypes();

      // equals and hashCode are special cased
      if (methodName.equals("equals")
      && params.length == 1 && params[0].equals(Object.class)) {
    Object value = args[0];
    if (value == null || ! Proxy.isProxyClass(value.getClass()))
      return new Boolean(false);

    HessianProxy handler = (HessianProxy) Proxy.getInvocationHandler(value);


It happens when the "equals" is called on a HessianProxy object. The implementation seems to assume that when argument is not null but is also a Proxy it has to be of type HessianProxy. That can be true, but it does not have to be.

I fully agree that this is a very specific case, but the ClassCastException that you get in the equals still sounds like a bug to me.


There are no notes attached to this issue.