Program: 94215
Project: 94215
Buggy source:
private ExportRegistration exportService(final ServiceReference serviceReference,Map<String,?> overridingProperties,String[] exportedInterfaces,IRemoteServiceContainer rsContainer,Map<String,Object> endpointDescriptionProperties) throws Exception {
  Map remoteServiceProperties=copyNonReservedProperties(serviceReference,(Map<String,Object>)overridingProperties,new TreeMap<String,Object>(String.CASE_INSENSITIVE_ORDER));
  IRemoteServiceContainerAdapter containerAdapter=rsContainer.getContainerAdapter();
  IRemoteServiceRegistration remoteRegistration=null;
  if (containerAdapter instanceof IOSGiRemoteServiceContainerAdapter) {
    IOSGiRemoteServiceContainerAdapter osgiContainerAdapter=(IOSGiRemoteServiceContainerAdapter)containerAdapter;
    remoteRegistration=osgiContainerAdapter.registerRemoteService(exportedInterfaces,serviceReference,PropertiesUtil.createDictionaryFromMap(remoteServiceProperties));
  }
 else {
    Object service=AccessController.doPrivileged(new PrivilegedAction<Object>(){
      public Object run(){
        return getClientBundleContext().getService(serviceReference);
      }
    }
);
    remoteRegistration=containerAdapter.registerRemoteService(exportedInterfaces,service,PropertiesUtil.createDictionaryFromMap(remoteServiceProperties));
  }
  endpointDescriptionProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,remoteRegistration.getProperty(org.eclipse.ecf.remoteservice.Constants.SERVICE_ID));
  EndpointDescription endpointDescription=new EndpointDescription(serviceReference,endpointDescriptionProperties);
  return new ExportRegistration(new ExportEndpoint(serviceReference,endpointDescription,remoteRegistration));
}

Fixed version (ground truth):
private ExportRegistration exportService(final ServiceReference serviceReference,Map<String,?> overridingProperties,String[] exportedInterfaces,IRemoteServiceContainer rsContainer,Map<String,Object> endpointDescriptionProperties) throws Exception {
  Map remoteServiceProperties=copyNonReservedProperties(serviceReference,(Map<String,Object>)overridingProperties,new TreeMap<String,Object>(String.CASE_INSENSITIVE_ORDER));
  IRemoteServiceContainerAdapter containerAdapter=rsContainer.getContainerAdapter();
  IRemoteServiceRegistration remoteRegistration=null;
  if (containerAdapter instanceof IOSGiRemoteServiceContainerAdapter) {
    IOSGiRemoteServiceContainerAdapter osgiContainerAdapter=(IOSGiRemoteServiceContainerAdapter)containerAdapter;
    remoteRegistration=osgiContainerAdapter.registerRemoteService(exportedInterfaces,serviceReference,PropertiesUtil.createDictionaryFromMap(remoteServiceProperties));
  }
 else {
    Object service=AccessController.doPrivileged(new PrivilegedAction<Object>(){
      public Object run(){
        return getClientBundleContext().getService(serviceReference);
      }
    }
);
    remoteRegistration=containerAdapter.registerRemoteService(exportedInterfaces,service,PropertiesUtil.createDictionaryFromMap(remoteServiceProperties));
  }
  endpointDescriptionProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,remoteRegistration.getProperty(org.eclipse.ecf.remoteservice.Constants.SERVICE_ID));
  endpointDescriptionProperties=PropertiesUtil.mergeProperties(remoteRegistration,endpointDescriptionProperties);
  EndpointDescription endpointDescription=new EndpointDescription(serviceReference,endpointDescriptionProperties);
  return new ExportRegistration(new ExportEndpoint(serviceReference,endpointDescription,remoteRegistration));
}