mx4j/src/core/mx4j/remote/rmi ClientInvoker.java,1.9,1.10

Simone Bordet <[email protected]> Sun, 23 Oct 2005 21:20:43 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote/rmi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22270/src/core/mx4j/remote/rmi

Modified Files:
	ClientInvoker.java 
Log Message:
Fixes for bug #1335777: <protocol>ConnectionMBeanServerConnection.removeNotificationListener() did not handle exceptions correctly, leaking listeners in the notification handler

Index: ClientInvoker.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/rmi/ClientInvoker.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ClientInvoker.java	13 Nov 2004 16:38:35 -0000	1.9
--- ClientInvoker.java	23 Oct 2005 21:20:41 -0000	1.10
***************
*** 83,88 ****
        Integer[] ids = notificationHandler.getNotificationListeners(new NotificationTuple(observed, listener));
        if (ids == null) throw new ListenerNotFoundException("Could not find listener " + listener);
!       connection.removeNotificationListeners(observed, ids, delegate);
!       notificationHandler.removeNotificationListeners(ids);
     }
  
--- 83,101 ----
        Integer[] ids = notificationHandler.getNotificationListeners(new NotificationTuple(observed, listener));
        if (ids == null) throw new ListenerNotFoundException("Could not find listener " + listener);
!       try
!       {
!          connection.removeNotificationListeners(observed, ids, delegate);
!          notificationHandler.removeNotificationListeners(ids);
!       }
!       catch (InstanceNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
!       catch (ListenerNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
     }
  
***************
*** 93,98 ****
        if (id == null) throw new ListenerNotFoundException("Could not find listener " + listener + " with filter " + filter + " and handback " + handback);
        Integer[] ids = new Integer[]{id};
!       connection.removeNotificationListeners(observed, ids, delegate);
!       notificationHandler.removeNotificationListeners(ids);
     }
  
--- 106,124 ----
        if (id == null) throw new ListenerNotFoundException("Could not find listener " + listener + " with filter " + filter + " and handback " + handback);
        Integer[] ids = new Integer[]{id};
!       try
!       {
!          connection.removeNotificationListeners(observed, ids, delegate);
!          notificationHandler.removeNotificationListeners(ids);
!       }
!       catch (InstanceNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
!       catch (ListenerNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
     }
  



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information