On Aug 28, 2008, at 9:19 AM, Christian Campo wrote:

Hi,

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.

What do you think ?

I've added it as a bug report.  http://bugs.caucho.com/view.php?id=2878

I think the right answer is to return false for that argument.

-- Scott


christian campo
_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to