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

Shri Shrikumar (JIRA) jira-events at lists.jboss.org
Tue Dec 11 08:44:55 EST 2007


    [ http://jira.jboss.com/jira/browse/EJBTHREE-748?page=comments#action_12391544 ] 
            
Shri Shrikumar commented on EJBTHREE-748:
-----------------------------------------

I can confirm this issue and also that the patch described above fixes it. I am surprised that it is still there and a resolution would be useful.

> 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