#106 Remote.equals(null) generates Exception

v2.4 (stable)
closed-fixed
nobody
7
2001-12-06
2001-12-05
No

This Bug affects both 3.0 alpha and 2.4.3

The problem is that a beans remote proxy when doing
Remote.equals(null) throws a null pointer exception.
It should rather return false as null is a valid value
for equals

The problem is in the implementation of
org.jboss.plugins.jrmp.interfaces.EntityProxy which
under invoke redefines .equals() as a call to
isIdentical() :

if (m.equals(GenericProxy.EQUALS))
return invoke(proxy, BeanProxy.IS_IDENTICAL, args);

and then defines .isIdentical() as:

if (m.equals(BeanProxy.IS_IDENTICAL))
return isIdentical(args[0], cacheKey.getId());

To fix the bug we need to change
org.jboss.plugins.jrmp.interfaces.BeanProxy.isIdentical
() to the following by inserting a guard condition for
null :

protected Boolean isIdentical(Object a, Object b)
throws RemoteException {
if( a == null) return false;
EJBObject ejb = (EJBObject) a;
Object pk = ejb.getPrimaryKey();
return new Boolean(pk.equals(b));
}

This problem is a real problem with the new
implementation of jetty in V3.0 because when inserting
stuff into the session, jetty checks to see if the
object is the same as the previous one by using
the .equals() command and for the first time the
previous one is null so you cannot insert an EJB
remote interface into the sesson.

Could someone verify this and please update CVS

Andrew Goedhart
(A developer using JBOSS in sunny South Africa)

Discussion

  • Andrew Goedhart

    Andrew Goedhart - 2001-12-05
    • priority: 5 --> 7
     
  • Scott M Stark

    Scott M Stark - 2001-12-06
    • status: open --> closed-fixed
     
  • Scott M Stark

    Scott M Stark - 2001-12-06

    Logged In: YES
    user_id=175228

    The change has been commited for the 2.4.4 final release.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks