Program: 103556
Project: 103556
Buggy source:
/** 
 * Implements the <tt>ServiceListener</tt> method. Verifies whether the passed event concerns a <tt>ProtocolProviderService</tt> and modifies the list of registered protocol providers accordingly.
 * @param event The <tt>ServiceEvent</tt> object.
 */
public void serviceChanged(ServiceEvent event){
  Object sService=bundleContext.getService(event.getServiceReference());
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + sService.getClass().getName());
  if (!(sService instanceof ProtocolProviderService)) {
    return;
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  ProtocolProviderService provider=(ProtocolProviderService)sService;
  ProtocolProviderFactory sourceFactory=null;
  ServiceReference[] allBundleServices=event.getServiceReference().getBundle().getRegisteredServices();
  for (  ServiceReference bundleServiceRef : allBundleServices) {
    Object service=bundleContext.getService(bundleServiceRef);
    if (service instanceof ProtocolProviderFactory) {
      sourceFactory=(ProtocolProviderFactory)service;
      break;
    }
  }
  if (event.getType() == ServiceEvent.REGISTERED) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    String providerMask=System.getProperty(MetaContactListService.PROVIDER_MASK_PROPERTY);
    if (providerMask != null && providerMask.trim().length() > 0) {
      String servRefMask=(String)event.getServiceReference().getProperty(MetaContactListService.PROVIDER_MASK_PROPERTY);
      if (servRefMask == null || !servRefMask.equals(providerMask)) {
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + provider.getAccountID());
        return;
      }
    }
    if (sourceFactory != null && currentlyInstalledProviders.containsKey(provider.getAccountID().getAccountUniqueID())) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + provider.getAccountID() + "String_Node_Str");
    }
    this.handleProviderAdded((ProtocolProviderService)sService);
  }
 else   if (event.getType() == ServiceEvent.UNREGISTERING) {
    if (sourceFactory == null) {
      return;
    }
    AccountID accountID=provider.getAccountID();
    if (sourceFactory.getRegisteredAccounts().contains(accountID)) {
synchronized (this) {
        this.removeMetaContactListListener(storageManager);
        this.handleProviderRemoved((ProtocolProviderService)sService);
        this.addMetaContactListListener(storageManager);
      }
      return;
    }
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + provider.getAccountID() + "String_Node_Str"+ "String_Node_Str");
    this.handleProviderRemoved((ProtocolProviderService)sService);
  }
}

Fixed version (ground truth):
/** 
 * Implements the <tt>ServiceListener</tt> method. Verifies whether the passed event concerns a <tt>ProtocolProviderService</tt> and modifies the list of registered protocol providers accordingly.
 * @param event The <tt>ServiceEvent</tt> object.
 */
public void serviceChanged(ServiceEvent event){
  Object sService=bundleContext.getService(event.getServiceReference());
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + sService.getClass().getName());
  if (!(sService instanceof ProtocolProviderService)) {
    return;
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  ProtocolProviderService provider=(ProtocolProviderService)sService;
  ProtocolProviderFactory sourceFactory=null;
  ServiceReference[] allBundleServices=event.getServiceReference().getBundle().getRegisteredServices();
  for (  ServiceReference bundleServiceRef : allBundleServices) {
    Object service=bundleContext.getService(bundleServiceRef);
    if (service instanceof ProtocolProviderFactory) {
      sourceFactory=(ProtocolProviderFactory)service;
      break;
    }
  }
  if (event.getType() == ServiceEvent.REGISTERED) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    String providerMask=System.getProperty(MetaContactListService.PROVIDER_MASK_PROPERTY);
    if (providerMask != null && providerMask.trim().length() > 0) {
      String servRefMask=(String)event.getServiceReference().getProperty(MetaContactListService.PROVIDER_MASK_PROPERTY);
      if (servRefMask == null || !servRefMask.equals(providerMask)) {
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + provider.getAccountID());
        return;
      }
    }
    if (sourceFactory != null && currentlyInstalledProviders.containsKey(provider.getAccountID().getAccountUniqueID())) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str" + provider.getAccountID() + "String_Node_Str");
    }
    this.handleProviderAdded((ProtocolProviderService)sService);
  }
 else   if (event.getType() == ServiceEvent.UNREGISTERING) {
    if (sourceFactory == null) {
      return;
    }
    AccountID accountID=provider.getAccountID();
    if (ContactlistActivator.getAccountManager().getStoredAccounts().contains(accountID)) {
synchronized (this) {
        this.removeMetaContactListListener(storageManager);
        this.handleProviderRemoved((ProtocolProviderService)sService);
        this.addMetaContactListListener(storageManager);
      }
      return;
    }
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + provider.getAccountID() + "String_Node_Str"+ "String_Node_Str");
    this.handleProviderRemoved((ProtocolProviderService)sService);
  }
}