Program: 49067
Project: 49067
Buggy source:
public boolean validateNodeGroupRoles(List<String> failedMsgList){
  boolean valid=true;
  Set<String> roles=new HashSet<String>();
  for (  NodeGroupCreate ngc : getNodeGroups()) {
    roles.addAll(ngc.getRoles());
  }
  if (validateHDFSUrl()) {
    if (getNodeGroups() == null) {
      valid=false;
      failedMsgList.add("String_Node_Str");
    }
 else {
      if (roles.contains("String_Node_Str") || roles.contains("String_Node_Str")) {
        valid=false;
        failedMsgList.add("String_Node_Str");
      }
      if (!roles.contains("String_Node_Str") || !roles.contains("String_Node_Str")) {
        valid=false;
        failedMsgList.add("String_Node_Str");
      }
    }
  }
 else {
    EnumSet<ServiceType> serviceTypes=EnumSet.noneOf(ServiceType.class);
    for (    ServiceType service : ServiceType.values()) {
      int matched=0;
      for (      HadoopRole role : service.getRoles()) {
        if (roles.contains(role.toString())) {
          matched++;
        }
      }
      if (matched == service.getRoles().size()) {
        serviceTypes.add(service);
      }
 else       if (matched != 0) {
        failedMsgList.add("String_Node_Str" + service + "String_Node_Str"+ service.getRoles()+ "String_Node_Str");
        valid=false;
      }
    }
    if (valid == true && !serviceTypes.isEmpty()) {
      for (      ServiceType service : serviceTypes) {
        EnumSet<ServiceType> dependency=service.depend();
        if (dependency != null && !serviceTypes.containsAll(dependency)) {
          failedMsgList.add("String_Node_Str" + dependency + "String_Node_Str"+ service+ "String_Node_Str");
          valid=false;
        }
      }
    }
  }
  return valid;
}

Fixed version (ground truth):
public boolean validateNodeGroupRoles(List<String> failedMsgList){
  boolean valid=true;
  Set<String> roles=new HashSet<String>();
  for (  NodeGroupCreate ngc : getNodeGroups()) {
    List<String> nodeGroupRoles=ngc.getRoles();
    if (nodeGroupRoles == null || nodeGroupRoles.isEmpty()) {
      valid=false;
      failedMsgList.add("String_Node_Str" + ngc.getName() + "String_Node_Str");
    }
 else {
      roles.addAll(ngc.getRoles());
    }
  }
  if (validateHDFSUrl()) {
    if (getNodeGroups() == null) {
      valid=false;
      failedMsgList.add("String_Node_Str");
    }
 else {
      if (roles.contains("String_Node_Str") || roles.contains("String_Node_Str")) {
        valid=false;
        failedMsgList.add("String_Node_Str");
      }
      if (!roles.contains("String_Node_Str") || !roles.contains("String_Node_Str")) {
        valid=false;
        failedMsgList.add("String_Node_Str");
      }
    }
  }
 else {
    EnumSet<ServiceType> serviceTypes=EnumSet.noneOf(ServiceType.class);
    for (    ServiceType service : ServiceType.values()) {
      int matched=0;
      for (      HadoopRole role : service.getRoles()) {
        if (roles.contains(role.toString())) {
          matched++;
        }
      }
      if (matched == service.getRoles().size()) {
        serviceTypes.add(service);
      }
 else       if (matched != 0) {
        failedMsgList.add("String_Node_Str" + service + "String_Node_Str"+ service.getRoles()+ "String_Node_Str");
        valid=false;
      }
    }
    if (valid == true && !serviceTypes.isEmpty()) {
      for (      ServiceType service : serviceTypes) {
        EnumSet<ServiceType> dependency=service.depend();
        if (dependency != null && !serviceTypes.containsAll(dependency)) {
          failedMsgList.add("String_Node_Str" + dependency + "String_Node_Str"+ service+ "String_Node_Str");
          valid=false;
        }
      }
    }
  }
  return valid;
}