[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java

emcho at dev.java.net emcho at dev.java.net
Mon May 21 19:49:59 CEST 2007


User: emcho   
Date: 2007-05-21 17:49:59+0000
Log:
 When handling ServiceEvent's, make sure they are triggerred by a ProtocolProviderService before handling them.

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/systray/jdic/
=============================================================================

File [changed]: SystrayServiceJdicImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java?r1=1.2&r2=1.3
Delta lines:  +92 -85
---------------------
--- SystrayServiceJdicImpl.java	2007-04-13 13:41:09+0000	1.2
+++ SystrayServiceJdicImpl.java	2007-05-21 17:49:56+0000	1.3
@@ -299,19 +299,26 @@
      */
     public void serviceChanged(ServiceEvent event)
     {        
-        ProtocolProviderService provider = (ProtocolProviderService)
-            SystrayActivator.bundleContext.getService(event.getServiceReference());
+        Object service = SystrayActivator.bundleContext
+            .getService( event.getServiceReference());
         
-        if (event.getType() == ServiceEvent.REGISTERED){
+        if (! (service instanceof ProtocolProviderService))
+            return;
+
+        ProtocolProviderService provider = (ProtocolProviderService)service;
+
+        if (event.getType() == ServiceEvent.REGISTERED)
+        {
             protocolProviderTable.put(provider.getAccountID(),provider);
             handleProviderAdded(provider);
             
         }
-        if (event.getType() == ServiceEvent.UNREGISTERING){
+
+        if (event.getType() == ServiceEvent.UNREGISTERING)
+        {
            protocolProviderTable.remove(provider.getAccountID());
            handleProviderRemoved(provider);
         }
-
     }
     
     /**




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list