Program: 102940
Project: 102940
Buggy source:
/** 
 * Starts this implementation of the MetaContactListService. The implementation would first restore a default contact list from what has been stored in a file. It would then connect to OSGI and retrieve any existing protocol providers and if <br> 1) They provide implementations of OperationSetPersistentPresence, it would synchronize their contact lists with the local one (adding subscriptions for contacts that do not exist in the server stored contact list and adding locally contacts that were found on the server but not in the local file). <p> 2) The only provide non persistent implementations of OperationSetPresence, the meta contact list impl would create subscriptions for all local contacts in the corresponding protocol provider. <p> This implementation would also start listening for any newly registered protocol provider implementations and perform the same algorithm with them. <p>
 * @param bc the currently valid OSGI bundle context.
 */
public void start(BundleContext bc){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  this.bundleContext=bc;
  try {
    storageManager.start(bundleContext,this);
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str",exc);
  }
  bc.addServiceListener(this);
  ServiceReference[] protocolProviderRefs=null;
  try {
    protocolProviderRefs=bc.getServiceReferences(ProtocolProviderService.class.getName(),null);
  }
 catch (  InvalidSyntaxException ex) {
    logger.error("String_Node_Str",ex);
    return;
  }
  if (protocolProviderRefs != null) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + protocolProviderRefs.length + "String_Node_Str");
    for (    ServiceReference providerRef : protocolProviderRefs) {
      ProtocolProviderService provider=(ProtocolProviderService)bc.getService(providerRef);
      this.handleProviderAdded(provider);
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts this implementation of the MetaContactListService. The implementation would first restore a default contact list from what has been stored in a file. It would then connect to OSGI and retrieve any existing protocol providers and if <br> 1) They provide implementations of OperationSetPersistentPresence, it would synchronize their contact lists with the local one (adding subscriptions for contacts that do not exist in the server stored contact list and adding locally contacts that were found on the server but not in the local file). <p> 2) The only provide non persistent implementations of OperationSetPresence, the meta contact list impl would create subscriptions for all local contacts in the corresponding protocol provider. <p> This implementation would also start listening for any newly registered protocol provider implementations and perform the same algorithm with them. <p>
 * @param bc the currently valid OSGI bundle context.
 */
public void start(BundleContext bc){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  this.bundleContext=bc;
  try {
    storageManager.start(bundleContext,this);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
  }
  bc.addServiceListener(this);
  Collection<ServiceReference<ProtocolProviderService>> ppsRefs=ServiceUtils.getServiceReferences(bc,ProtocolProviderService.class);
  if (!ppsRefs.isEmpty()) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + ppsRefs.size() + "String_Node_Str");
    }
    for (    ServiceReference<ProtocolProviderService> ppsRef : ppsRefs) {
      ProtocolProviderService pps=bc.getService(ppsRef);
      handleProviderAdded(pps);
    }
  }
}