Program: 116319
Project: 116319
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 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;
    Application application=ApplicationHolder.getApplications().getApplication(appId);
    if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Active) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Active) || getAllClusterInSameState(clusterData,ClusterStatus.Active) && getAllGroupInSameState(groups,GroupStatus.Active)) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        ApplicationBuilder.handleApplicationActivatedEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupActivatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Terminated) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Terminated) || getAllClusterInSameState(clusterData,ClusterStatus.Terminated) && getAllGroupInSameState(groups,GroupStatus.Terminated)) {
      if (parent instanceof Application) {
        if (application.getStatus().equals(ApplicationStatus.Terminating)) {
          log.info("String_Node_Str" + appId);
          ApplicationBuilder.handleApplicationTerminatedEvent(appId);
        }
 else {
          log.info("String_Node_Str" + appId + "String_Node_Str"+ application.getStatus().toString()+ "String_Node_Str");
        }
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupTerminatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Created) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Created) || getAllClusterInSameState(clusterData,ClusterStatus.Created) && getAllGroupInSameState(groups,GroupStatus.Created)) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId + "String_Node_Str"+ "String_Node_Str"+ application.getStatus().toString());
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupCreatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInactive(clusterData) || clusterData.isEmpty() && getAllGroupInActive(groups) || getAllClusterInactive(clusterData) && getAllGroupInActive(groups)) {
      if (parent instanceof Application) {
        log.warn("String_Node_Str" + appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupInActivateEvent(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 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;
    Application application=ApplicationHolder.getApplications().getApplication(appId);
    if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Active) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Active) || getAllClusterInSameState(clusterData,ClusterStatus.Active) && getAllGroupInSameState(groups,GroupStatus.Active)) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId);
        ApplicationBuilder.handleApplicationActivatedEvent(appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupActivatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Terminated) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Terminated) || getAllClusterInSameState(clusterData,ClusterStatus.Terminated) && getAllGroupInSameState(groups,GroupStatus.Terminated)) {
      if (parent instanceof Application) {
        if (application.getStatus().equals(ApplicationStatus.Terminating)) {
          log.info("String_Node_Str" + appId);
          ApplicationBuilder.handleApplicationTerminatedEvent(appId);
        }
 else {
          log.info("String_Node_Str" + appId + "String_Node_Str"+ application.getStatus().toString()+ "String_Node_Str");
        }
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupTerminatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInSameState(clusterData,ClusterStatus.Created) || clusterData.isEmpty() && getAllGroupInSameState(groups,GroupStatus.Created) || getAllClusterInSameState(clusterData,ClusterStatus.Created) && getAllGroupInSameState(groups,GroupStatus.Created)) {
      if (parent instanceof Application) {
        log.info("String_Node_Str" + appId + "String_Node_Str"+ "String_Node_Str"+ application.getStatus().toString());
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupCreatedEvent(appId,parent.getUniqueIdentifier());
      }
    }
 else     if (groups.isEmpty() && getAllClusterInactive(clusterData) || clusterData.isEmpty() && getAllGroupInActive(groups) || getAllClusterInactive(clusterData) || getAllGroupInActive(groups)) {
      if (parent instanceof Application) {
        log.warn("String_Node_Str" + appId);
      }
 else       if (parent instanceof Group) {
        log.info("String_Node_Str" + parent.getUniqueIdentifier());
        ApplicationBuilder.handleGroupInActivateEvent(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;
}