Program: 94413
Project: 94413
Buggy source:
/** 
 * @param reference
 */
private void handleServicePublication(ServiceReference reference){
  Collection svcInterfaces=ServicePropertyUtils.getCollectionProperty(reference,ServicePublication.SERVICE_INTERFACE_NAME);
  if (svcInterfaces == null) {
    logError("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  IServiceProperties discoveryServiceProperties=new ServiceProperties();
  discoveryServiceProperties.setPropertyString(ServicePublication.SERVICE_INTERFACE_NAME,ServicePropertyUtils.createStringFromCollection(svcInterfaces));
  Map servicePublicationServiceProperties=ServicePropertyUtils.getMapProperty(reference,ServicePublication.SERVICE_PROPERTIES);
  if (servicePublicationServiceProperties != null)   addPropertiesToDiscoveryServiceProperties(discoveryServiceProperties,servicePublicationServiceProperties);
  ID endpointContainerID=(ID)reference.getProperty(RemoteServicePublication.ENDPOINT_CONTAINERID);
  if (endpointContainerID == null) {
    logError("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  discoveryServiceProperties.setPropertyBytes(RemoteServicePublication.ENDPOINT_CONTAINERID,endpointContainerID.toExternalForm().getBytes());
  String endpointNamespace=endpointContainerID.getNamespace().getName();
  discoveryServiceProperties.setPropertyString(RemoteServicePublication.ENDPOINT_CONTAINERID_NAMESPACE,endpointNamespace);
  ID targetContainerID=(ID)reference.getProperty(RemoteServicePublication.TARGET_CONTAINERID);
  if (targetContainerID != null) {
    discoveryServiceProperties.setPropertyBytes(RemoteServicePublication.TARGET_CONTAINERID,targetContainerID.toExternalForm().getBytes());
    String targetNamespace=targetContainerID.getNamespace().getName();
    discoveryServiceProperties.setPropertyString(RemoteServicePublication.TARGET_CONTAINERID_NAMESPACE,targetNamespace);
  }
  String rsnamespace=ServicePropertyUtils.getStringProperty(reference,Constants.SERVICE_NAMESPACE);
  if (rsnamespace != null)   discoveryServiceProperties.setPropertyString(Constants.SERVICE_NAMESPACE,rsnamespace);
  byte[] remoteServiceIDAsBytes=(byte[])reference.getProperty(Constants.SERVICE_ID);
  if (remoteServiceIDAsBytes != null)   discoveryServiceProperties.setPropertyBytes(Constants.SERVICE_ID,remoteServiceIDAsBytes);
  IDiscoveryAdvertiser advertiser2=getAdvertiser();
  if (advertiser2 == null) {
    logError("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  Namespace advertiserNamespace=advertiser2.getServicesNamespace();
  IServiceInfo svcInfo=null;
  try {
    IServiceTypeID serviceTypeID=createServiceTypeID(servicePublicationServiceProperties,advertiserNamespace);
    URI uri=createURI(endpointContainerID);
    String serviceName=getPropertyWithDefault(servicePublicationServiceProperties,RemoteServicePublication.SERVICE_NAME,(RemoteServicePublication.DEFAULT_SERVICE_NAME_PREFIX + new String(remoteServiceIDAsBytes)));
    svcInfo=new ServiceInfo(uri,serviceName,serviceTypeID,discoveryServiceProperties);
  }
 catch (  IDCreateException e) {
    logError("String_Node_Str","String_Node_Str",e);
    return;
  }
catch (  URISyntaxException e) {
    logError("String_Node_Str","String_Node_Str",e);
    return;
  }
  fireHostPublishUnpublish(reference,svcInfo,true);
synchronized (serviceInfos) {
    try {
      trace("String_Node_Str","String_Node_Str" + reference + "String_Node_Str"+ svcInfo);
      advertiser2.registerService(svcInfo);
      addServiceInfo(reference,svcInfo);
    }
 catch (    ECFRuntimeException e) {
      logError("String_Node_Str","String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param reference
 */
private void handleServicePublication(ServiceReference reference){
  Collection svcInterfaces=ServicePropertyUtils.getCollectionProperty(reference,ServicePublication.SERVICE_INTERFACE_NAME);
  if (svcInterfaces == null) {
    logError("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  IServiceProperties discoveryServiceProperties=new ServiceProperties();
  discoveryServiceProperties.setPropertyString(ServicePublication.SERVICE_INTERFACE_NAME,ServicePropertyUtils.createStringFromCollection(svcInterfaces));
  Map servicePublicationServiceProperties=ServicePropertyUtils.getMapProperty(reference,ServicePublication.SERVICE_PROPERTIES);
  if (servicePublicationServiceProperties != null)   addPropertiesToDiscoveryServiceProperties(discoveryServiceProperties,servicePublicationServiceProperties);
  ID endpointContainerID=(ID)reference.getProperty(RemoteServicePublication.ENDPOINT_CONTAINERID);
  if (endpointContainerID == null) {
    logError("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  discoveryServiceProperties.setPropertyBytes(RemoteServicePublication.ENDPOINT_CONTAINERID,endpointContainerID.toExternalForm().getBytes());
  String endpointNamespace=endpointContainerID.getNamespace().getName();
  discoveryServiceProperties.setPropertyString(RemoteServicePublication.ENDPOINT_CONTAINERID_NAMESPACE,endpointNamespace);
  ID targetContainerID=(ID)reference.getProperty(RemoteServicePublication.TARGET_CONTAINERID);
  if (targetContainerID != null) {
    discoveryServiceProperties.setPropertyBytes(RemoteServicePublication.TARGET_CONTAINERID,targetContainerID.toExternalForm().getBytes());
    String targetNamespace=targetContainerID.getNamespace().getName();
    discoveryServiceProperties.setPropertyString(RemoteServicePublication.TARGET_CONTAINERID_NAMESPACE,targetNamespace);
  }
  String rsnamespace=ServicePropertyUtils.getStringProperty(reference,Constants.SERVICE_NAMESPACE);
  if (rsnamespace != null)   discoveryServiceProperties.setPropertyString(Constants.SERVICE_NAMESPACE,rsnamespace);
  byte[] remoteServiceIDAsBytes=(byte[])reference.getProperty(Constants.SERVICE_ID);
  if (remoteServiceIDAsBytes != null)   discoveryServiceProperties.setPropertyBytes(Constants.SERVICE_ID,remoteServiceIDAsBytes);
  IDiscoveryAdvertiser advertiser2=getAdvertiser();
  if (advertiser2 == null) {
    logInfo("String_Node_Str","String_Node_Str" + reference + "String_Node_Str",null);
    return;
  }
  Namespace advertiserNamespace=advertiser2.getServicesNamespace();
  IServiceInfo svcInfo=null;
  try {
    IServiceTypeID serviceTypeID=createServiceTypeID(servicePublicationServiceProperties,advertiserNamespace);
    URI uri=createURI(endpointContainerID);
    String serviceName=getPropertyWithDefault(servicePublicationServiceProperties,RemoteServicePublication.SERVICE_NAME,(RemoteServicePublication.DEFAULT_SERVICE_NAME_PREFIX + new String(remoteServiceIDAsBytes)));
    svcInfo=new ServiceInfo(uri,serviceName,serviceTypeID,discoveryServiceProperties);
  }
 catch (  IDCreateException e) {
    logError("String_Node_Str","String_Node_Str",e);
    return;
  }
catch (  URISyntaxException e) {
    logError("String_Node_Str","String_Node_Str",e);
    return;
  }
  fireHostPublishUnpublish(reference,svcInfo,true);
synchronized (serviceInfos) {
    try {
      trace("String_Node_Str","String_Node_Str" + reference + "String_Node_Str"+ svcInfo);
      advertiser2.registerService(svcInfo);
      addServiceInfo(reference,svcInfo);
    }
 catch (    ECFRuntimeException e) {
      logError("String_Node_Str","String_Node_Str",e);
    }
  }
}