Program: 116439
Project: 116439
Buggy source:
/** 
 * This will use to calculate whether  all children of a particular component is active by travesing Top
 * @param appId
 * @param id
 * @param groups
 * @param clusterData
 * @param parent
 * @return
 */
private boolean updateChildStatus(String appId,String id,Map<String,Group> groups,Map<String,ClusterDataHolder> clusterData,ParentComponent parent){
  boolean groupActive=false;
  ClusterStatus clusterStatus;
  GroupStatus groupStatus;
  boolean childFound=false;
  boolean clusterFound=false;
  for (  ClusterDataHolder clusterDataHolder : clusterData.values()) {
    if (clusterDataHolder.getClusterId().equals(id)) {
      clusterFound=true;
    }
  }
  log.info("String_Node_Str" + clusterFound);
  if (clusterFound || groups.containsKey(id)) {
    childFound=true;
    clusterStatus=getClusterStatus(clusterData);
    groupStatus=getGroupStatus(groups);
    if (groups.isEmpty() && clusterStatus == ClusterStatus.Active || clusterData.isEmpty() && groupStatus == GroupStatus.Active || groupStatus == GroupStatus.Active && clusterStatus == ClusterStatus.Active) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        StatusEventPublisher.sendApplicationActivatedEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupActivatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Inactive || clusterData.isEmpty() && groupStatus == GroupStatus.Inactive || groupStatus == GroupStatus.Inactive && clusterStatus == ClusterStatus.Inactive) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        StatusEventPublisher.sendApplicationInactivatedEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupInActivateEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminated || clusterData.isEmpty() && groupStatus == GroupStatus.Terminated || groupStatus == GroupStatus.Terminated && clusterStatus == ClusterStatus.Terminated) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        StatusEventPublisher.sendApplicationTerminatedEvent(appId,parent.getClusterDataRecursively());
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupTerminatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminating || clusterData.isEmpty() && groupStatus == GroupStatus.Terminating || groupStatus == GroupStatus.Terminating && clusterStatus == ClusterStatus.Terminating) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        StatusEventPublisher.sendApplicationTerminatingEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupTerminatingEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else {
      log.warn("String_Node_Str" + appId);
    }
    return childFound;
  }
 else {
    log.warn("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ parent.getUniqueIdentifier());
  }
  return childFound;
}

Fixed version (ground truth):
/** 
 * This will use to calculate whether  all children of a particular component is active by travesing Top
 * @param appId
 * @param id
 * @param groups
 * @param clusterData
 * @param parent
 * @return
 */
private boolean updateChildStatus(String appId,String id,Map<String,Group> groups,Map<String,ClusterDataHolder> clusterData,ParentComponent parent){
  boolean groupActive=false;
  ClusterStatus clusterStatus;
  GroupStatus groupStatus;
  boolean childFound=false;
  boolean clusterFound=false;
  for (  ClusterDataHolder clusterDataHolder : clusterData.values()) {
    if (clusterDataHolder.getClusterId().equals(id)) {
      clusterFound=true;
    }
  }
  log.info("String_Node_Str" + clusterFound);
  if (clusterFound || groups.containsKey(id)) {
    childFound=true;
    clusterStatus=getClusterStatus(clusterData);
    groupStatus=getGroupStatus(groups);
    if (groups.isEmpty() && clusterStatus == ClusterStatus.Active || clusterData.isEmpty() && groupStatus == GroupStatus.Active || groupStatus == GroupStatus.Active && clusterStatus == ClusterStatus.Active) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        StatusEventPublisher.sendApplicationActivatedEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupActivatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Inactive || clusterData.isEmpty() && groupStatus == GroupStatus.Inactive || groupStatus == GroupStatus.Inactive && clusterStatus == ClusterStatus.Inactive) {
      if (parent instanceof Application) {
        log.warn("String_Node_Str" + appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupInActivateEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminated || clusterData.isEmpty() && groupStatus == GroupStatus.Terminated || groupStatus == GroupStatus.Terminated && clusterStatus == ClusterStatus.Terminated) {
      if (parent instanceof Application) {
        try {
          TopologyManager.acquireReadLockForApplication(appId);
          Application application=TopologyManager.getTopology().getApplication(appId);
          if (application.getStatus().equals(ApplicationStatus.Terminating)) {
            log.info("String_Node_Str" + appId);
            StatusEventPublisher.sendApplicationTerminatedEvent(appId,parent.getClusterDataRecursively());
          }
 else {
            log.info("String_Node_Str" + appId + "String_Node_Str"+ application.getStatus().toString()+ "String_Node_Str");
          }
        }
  finally {
          TopologyManager.releaseReadLockForApplication(appId);
        }
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupTerminatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminating || clusterData.isEmpty() && groupStatus == GroupStatus.Terminating || groupStatus == GroupStatus.Terminating && clusterStatus == ClusterStatus.Terminating) {
      if (parent instanceof Application) {
        log.warn("String_Node_Str" + appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        StatusEventPublisher.sendGroupTerminatingEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else {
      log.warn("String_Node_Str" + appId);
    }
    return childFound;
  }
 else {
    log.warn("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ parent.getUniqueIdentifier());
  }
  return childFound;
}