Program: 48518
Project: 48518
Buggy source:
private void validateRoles(ClusterBlueprint blueprint,List<String> unRecogConfigTypes,List<String> unRecogConfigKeys,String stackVendor,String stackVersion,String distro){
  Map<String,Integer> definedRoles=new HashMap<String,Integer>();
  List<String> unRecogRoles=null;
  List<NodeGroupInfo> nodeGroups=blueprint.getNodeGroups();
  if (nodeGroups == null || nodeGroups.isEmpty()) {
    return;
  }
  ApiStackServiceList servicesList=apiManager.getStackServiceListWithComponents(stackVendor,stackVersion);
  List<ApiStackComponent> apiStackComponents=new ArrayList<ApiStackComponent>();
  for (  ApiStackService apiStackService : servicesList.getApiStackServices()) {
    for (    ApiStackComponent apiStackComponent : apiStackService.getServiceComponents()) {
      apiStackComponents.add(apiStackComponent);
    }
  }
  for (  NodeGroupInfo group : nodeGroups) {
    validateConfigs(group.getConfiguration(),unRecogConfigTypes,unRecogConfigKeys,stackVendor,stackVersion);
    for (    String roleName : group.getRoles()) {
      boolean isSupported=false;
      for (      ApiStackComponent apiStackComponent : apiStackComponents) {
        if (roleName.equals(apiStackComponent.getApiComponent().getComponentName())) {
          isSupported=true;
          if (isSupported) {
            continue;
          }
        }
      }
      if (!isSupported) {
        if (unRecogRoles == null) {
          unRecogRoles=new ArrayList<String>();
        }
        unRecogRoles.add(roleName);
        continue;
      }
 else {
        if (!definedRoles.containsKey(roleName)) {
          definedRoles.put(roleName,group.getInstanceNum());
        }
 else {
          Integer instanceNum=definedRoles.get(roleName) + group.getInstanceNum();
          definedRoles.put(roleName,instanceNum);
        }
      }
    }
  }
  if (unRecogRoles != null && !unRecogRoles.isEmpty()) {
    errorMsgList.add("String_Node_Str" + unRecogRoles.toString() + "String_Node_Str"+ distro);
  }
  validateRoleDependencies(nodeGroups,apiStackComponents,definedRoles);
}

Fixed version (ground truth):
private void validateRoles(ClusterBlueprint blueprint,List<String> unRecogConfigTypes,List<String> unRecogConfigKeys,String stackVendor,String stackVersion,String distro){
  Map<String,Integer> definedRoles=new HashMap<String,Integer>();
  List<String> unRecogRoles=null;
  List<NodeGroupInfo> nodeGroups=blueprint.getNodeGroups();
  if (nodeGroups == null || nodeGroups.isEmpty()) {
    return;
  }
  ApiStackServiceList servicesList=apiManager.getStackServiceListWithComponents(stackVendor,stackVersion);
  List<ApiStackComponent> apiStackComponents=new ArrayList<ApiStackComponent>();
  for (  ApiStackService apiStackService : servicesList.getApiStackServices()) {
    for (    ApiStackComponent apiStackComponent : apiStackService.getServiceComponents()) {
      apiStackComponents.add(apiStackComponent);
    }
  }
  for (  NodeGroupInfo group : nodeGroups) {
    validateConfigs(group.getConfiguration(),unRecogConfigTypes,unRecogConfigKeys,stackVendor,stackVersion);
    for (    String roleName : group.getRoles()) {
      boolean isSupported=false;
      for (      ApiStackComponent apiStackComponent : apiStackComponents) {
        if (roleName.equals(apiStackComponent.getApiComponent().getComponentName())) {
          isSupported=true;
          if (isSupported) {
            continue;
          }
        }
      }
      if (!isSupported) {
        if (unRecogRoles == null) {
          unRecogRoles=new ArrayList<String>();
        }
        unRecogRoles.add(roleName);
        continue;
      }
 else {
        if (!definedRoles.containsKey(roleName)) {
          definedRoles.put(roleName,group.getInstanceNum());
        }
 else {
          Integer instanceNum=definedRoles.get(roleName) + group.getInstanceNum();
          definedRoles.put(roleName,instanceNum);
        }
      }
    }
  }
  if (unRecogRoles != null && !unRecogRoles.isEmpty()) {
    errorMsgList.add("String_Node_Str" + unRecogRoles.toString() + "String_Node_Str"+ distro);
  }
  validateRoleDependencies(nodeGroups,apiStackComponents,unRecogRoles);
}