mx4j/src/tools/mx4j/tools/remote/http HTTPConnectionMBeanServerConnection.java,1.3,1.4

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/tools/mx4j/tools/remote/http
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22270/src/tools/mx4j/tools/remote/http

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

Index: HTTPConnectionMBeanServerConnection.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/http/HTTPConnectionMBeanServerConnection.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** HTTPConnectionMBeanServerConnection.java	13 Nov 2004 16:38:47 -0000	1.3
--- HTTPConnectionMBeanServerConnection.java	23 Oct 2005 21:20:41 -0000	1.4
***************
*** 55,60 ****
        Integer[] ids = notificationHandler.getNotificationListeners(new NotificationTuple(observed, listener));
        if (ids == null) throw new ListenerNotFoundException("Could not find listener " + listener);
!       ((HTTPConnection)getConnection()).removeNotificationListeners(observed, ids, getDelegateSubject());
!       notificationHandler.removeNotificationListeners(ids);
     }
  
--- 55,73 ----
        Integer[] ids = notificationHandler.getNotificationListeners(new NotificationTuple(observed, listener));
        if (ids == null) throw new ListenerNotFoundException("Could not find listener " + listener);
!       try
!       {
!          ((HTTPConnection)getConnection()).removeNotificationListeners(observed, ids, getDelegateSubject());
!          notificationHandler.removeNotificationListeners(ids);
!       }
!       catch (InstanceNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
!       catch (ListenerNotFoundException x)
!       {
!          notificationHandler.removeNotificationListeners(ids);
!          throw x;
!       }
     }
  
***************
*** 64,69 ****
        if (id == null) throw new ListenerNotFoundException("Could not find listener " + listener + " with filter " + filter + " and handback " + handback);
        Integer[] ids = new Integer[]{id};
!       ((HTTPConnection)getConnection()).removeNotificationListeners(observed, ids, getDelegateSubject());
!       notificationHandler.removeNotificationListeners(ids);
     }
  }
--- 77,95 ----
        if (id == null) throw new ListenerNotFoundException("Could not find listener " + listener + " with filter " + filter + " and handback " + handback);
        Integer[] ids = new Integer[]{id};
!       try
!       {
!          ((HTTPConnection)getConnection()).removeNotificationListeners(observed, ids, getDelegateSubject());
!          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