[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-748) The implementation of equals() in org.jboss.ejb3.ProxyUtils.handleCallLocally() throws a NPE when being passed a null argument.

Nicolas Bielza (JIRA) jira-events at jboss.com
Tue Oct 17 11:42:43 EDT 2006


The implementation of equals() in org.jboss.ejb3.ProxyUtils.handleCallLocally() throws a NPE when being passed a null argument.
-------------------------------------------------------------------------------------------------------------------------------

                 Key: EJBTHREE-748
                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-748
             Project: EJB 3.0
          Issue Type: Bug
         Environment: Embedded EJB3 container
            Reporter: Nicolas Bielza


When looking up an entity bean, we get a proxy which implements equals() in a broken way:

Here's an example:

    // Proxy NPE test:
    InitialContext ctx = new InitialContext();
    Manager m = (Manager)ctx.lookup("ManagerAction/local");
    try {
    	if(m != null) {
    		m.equals(null);
    	}
	  	System.err.println("What bug ???");
    } catch(NullPointerException e) {
    	System.err.println("ProxyUtils NPE bug detected.");
    	e.printStackTrace();
    }

And the output:

ProxyUtils NPE bug detected.
java.lang.NullPointerException
	at org.jboss.ejb3.ProxyUtils.handleCallLocally(ProxyUtils.java:156)
	at org.jboss.ejb3.ProxyUtils.handleCallLocally(ProxyUtils.java:137)
	at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:92)
	at $Proxy34.equals(Unknown Source)
	at com.alligacom.nett.NetTransferAdminInterface.<init>(NetTransferAdminInterface.java:49)
	at com.alligacom.nett.NetTransferAdminInterface.main(NetTransferAdminI nterface.java:87)

The incriminated line (156) in ProxyUtils is:

return new Boolean(ih.toString().equals(args[0].toString()));

and should be:

return new Boolean(args[0] == null ? false : ih.toString().equals(args[0].toString()));



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list