Program: 115442
Project: 115442
Buggy source:
/** 
 * Remove member from topology and send member terminated event.
 * @param serviceName
 * @param clusterId
 * @param networkPartitionId
 * @param partitionId
 * @param memberId
 */
public static void handleMemberTerminated(String serviceName,String clusterId,String networkPartitionId,String partitionId,String memberId) throws RegistryException {
  Topology topology=TopologyHolder.getTopology();
  Service service=topology.getService(serviceName);
  Properties properties;
  if (service == null) {
    throw new RuntimeException(String.format("String_Node_Str",serviceName));
  }
  Cluster cluster=service.getCluster(clusterId);
  if (cluster == null) {
    throw new RuntimeException(String.format("String_Node_Str",clusterId,serviceName));
  }
  String applicationId=service.getCluster(clusterId).getAppId();
  String clusterAlias=CloudControllerUtil.getAliasFromClusterId(clusterId);
  Member member=cluster.getMember(memberId);
  if (member == null) {
    throw new RuntimeException((String.format("String_Node_Str",memberId)));
  }
  String clusterInstanceId=member.getClusterInstanceId();
  Long timestamp=null;
  try {
    TopologyHolder.acquireWriteLock();
    properties=member.getProperties();
    cluster.removeMember(member);
    TopologyHolder.updateTopology(topology);
  }
  finally {
    TopologyHolder.releaseWriteLock();
    timestamp=System.currentTimeMillis();
  }
  String groupAlias=null;
  TopologyEventPublisher.sendMemberTerminatedEvent(serviceName,clusterId,memberId,clusterInstanceId,networkPartitionId,partitionId,properties,groupAlias);
  MemberStatusPublisher memStatusPublisher=CloudControllerPublisherFactory.createMemberStatusPublisher(StatisticsPublisherType.WSO2DAS);
  if (memStatusPublisher.isEnabled()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    memStatusPublisher.publish(timestamp,applicationId,member.getClusterId(),clusterAlias,member.getClusterInstanceId(),member.getServiceName(),member.getNetworkPartitionId(),member.getPartitionId(),member.getMemberId(),MemberStatus.Terminated.toString());
  }
 else {
    log.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Remove member from topology and send member terminated event.
 * @param serviceName
 * @param clusterId
 * @param networkPartitionId
 * @param partitionId
 * @param memberId
 */
public static void handleMemberTerminated(String serviceName,String clusterId,String networkPartitionId,String partitionId,String memberId) throws RegistryException {
  Topology topology=TopologyHolder.getTopology();
  Service service=topology.getService(serviceName);
  Properties properties;
  if (service == null) {
    throw new RuntimeException(String.format("String_Node_Str",serviceName));
  }
  Cluster cluster=service.getCluster(clusterId);
  if (cluster == null) {
    throw new RuntimeException(String.format("String_Node_Str",clusterId,serviceName));
  }
  String applicationId=service.getCluster(clusterId).getAppId();
  String clusterAlias=CloudControllerUtil.getAliasFromClusterId(clusterId);
  Member member=cluster.getMember(memberId);
  if (member == null) {
    throw new RuntimeException((String.format("String_Node_Str",memberId)));
  }
  String clusterInstanceId=member.getClusterInstanceId();
  Long timestamp=null;
  try {
    TopologyHolder.acquireWriteLock();
    properties=member.getProperties();
    cluster.removeMember(member);
    TopologyHolder.updateTopology(topology);
  }
  finally {
    TopologyHolder.releaseWriteLock();
    timestamp=System.currentTimeMillis();
  }
  String groupAlias=null;
  TopologyEventPublisher.sendMemberTerminatedEvent(serviceName,clusterId,memberId,clusterInstanceId,networkPartitionId,partitionId,properties,groupAlias);
  if (memStatusPublisher.isEnabled()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    memStatusPublisher.publish(timestamp,applicationId,member.getClusterId(),clusterAlias,member.getClusterInstanceId(),member.getServiceName(),member.getNetworkPartitionId(),member.getPartitionId(),member.getMemberId(),MemberStatus.Terminated.toString());
  }
}