Program: 48951
Project: 48951
Buggy source:
private String createVcResourcePools(List<BaseNode> vNodes){
  logger.info("String_Node_Str");
  String clusterName=vNodes.get(0).getClusterName();
  String uuid=ConfigInfo.getSerengetiUUID();
  String clusterRpName=uuid + "String_Node_Str" + clusterName;
  if (clusterRpName.length() > VC_RP_MAX_NAME_LENGTH) {
    throw ClusteringServiceException.CLUSTER_NAME_TOO_LONG(clusterName);
  }
  Map<String,List<String>> vcClusterRpNamesMap=new HashMap<String,List<String>>();
  Map<Long,List<NodeGroupCreate>> rpNodeGroupsMap=new HashMap<Long,List<NodeGroupCreate>>();
  Map<String,Integer> countResult=collectResourcePoolInfo(vNodes,vcClusterRpNamesMap,rpNodeGroupsMap);
  try {
    int resourcePoolNameCount=countResult.get("String_Node_Str");
    Callable<Void>[] clusterSPs=new Callable[resourcePoolNameCount];
    int i=0;
    for (    Entry<String,List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap.entrySet()) {
      String vcClusterName=vcClusterRpNamesEntry.getKey();
      List<String> resourcePoolNames=vcClusterRpNamesEntry.getValue();
      for (      String resourcePoolName : resourcePoolNames) {
        VcResourcePool parentVcResourcePool=VcResourceUtils.findRPInVCCluster(vcClusterName,resourcePoolName);
        CreateResourcePoolSP clusterSP=new CreateResourcePoolSP(parentVcResourcePool,clusterRpName);
        clusterSPs[i]=clusterSP;
        i++;
      }
    }
    logger.info("String_Node_Str");
    executeResourcePoolStoreProcedures(clusterSPs,"String_Node_Str",clusterName);
    int nodeGroupNameCount=countResult.get("String_Node_Str");
    Callable<Void>[] nodeGroupSPs=new Callable[nodeGroupNameCount];
    i=0;
    for (    Entry<String,List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap.entrySet()) {
      String vcClusterName=vcClusterRpNamesEntry.getKey();
      VcCluster vcCluster=VcResourceUtils.findVcCluster(vcClusterName);
      if (!vcCluster.getConfig().getDRSEnabled()) {
        continue;
      }
      List<String> resourcePoolNames=vcClusterRpNamesEntry.getValue();
      for (      String resourcePoolName : resourcePoolNames) {
        VcResourcePool parentVcResourcePool=null;
        String vcRPName=CommonUtil.isBlank(resourcePoolName) ? clusterRpName : resourcePoolName + "String_Node_Str" + clusterRpName;
        parentVcResourcePool=VcResourceUtils.findRPInVCCluster(vcClusterName,vcRPName);
        long rpHashCode=vcClusterName.hashCode() ^ (vcClusterName + resourcePoolName).hashCode();
        for (        NodeGroupCreate nodeGroup : rpNodeGroupsMap.get(rpHashCode)) {
          AuAssert.check(nodeGroup != null,"String_Node_Str");
          if (nodeGroup.getName().length() > 80) {
            throw ClusteringServiceException.GROUP_NAME_TOO_LONG(clusterName);
          }
          CreateResourcePoolSP nodeGroupSP=new CreateResourcePoolSP(parentVcResourcePool,nodeGroup.getName(),nodeGroup);
          nodeGroupSPs[i]=nodeGroupSP;
          i++;
        }
      }
    }
    logger.info("String_Node_Str");
    executeResourcePoolStoreProcedures(nodeGroupSPs,"String_Node_Str",clusterName);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
  return clusterRpName;
}

Fixed version (ground truth):
private String createVcResourcePools(List<BaseNode> vNodes){
  logger.info("String_Node_Str");
  String clusterName=vNodes.get(0).getClusterName();
  String uuid=ConfigInfo.getSerengetiUUID();
  String clusterRpName=uuid + "String_Node_Str" + clusterName;
  if (clusterRpName.length() > VC_RP_MAX_NAME_LENGTH) {
    throw ClusteringServiceException.CLUSTER_NAME_TOO_LONG(clusterName);
  }
  Map<String,List<String>> vcClusterRpNamesMap=new HashMap<String,List<String>>();
  Map<Long,List<NodeGroupCreate>> rpNodeGroupsMap=new HashMap<Long,List<NodeGroupCreate>>();
  Map<String,Integer> countResult=collectResourcePoolInfo(vNodes,vcClusterRpNamesMap,rpNodeGroupsMap);
  try {
    int resourcePoolNameCount=countResult.get("String_Node_Str");
    Callable<Void>[] clusterSPs=new Callable[resourcePoolNameCount];
    int i=0;
    for (    Entry<String,List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap.entrySet()) {
      String vcClusterName=vcClusterRpNamesEntry.getKey();
      VcCluster vcCluster=VcResourceUtils.findVcCluster(vcClusterName);
      if (vcCluster == null) {
        String errorMsg="String_Node_Str" + vcClusterName + "String_Node_Str";
        logger.error(errorMsg);
        throw BddException.INTERNAL(null,errorMsg);
      }
      List<String> resourcePoolNames=vcClusterRpNamesEntry.getValue();
      for (      String resourcePoolName : resourcePoolNames) {
        VcResourcePool parentVcResourcePool=VcResourceUtils.findRPInVCCluster(vcClusterName,resourcePoolName);
        if (parentVcResourcePool == null) {
          String errorMsg="String_Node_Str" + resourcePoolName + "String_Node_Str";
          logger.error(errorMsg);
          throw BddException.INTERNAL(null,errorMsg);
        }
        CreateResourcePoolSP clusterSP=new CreateResourcePoolSP(parentVcResourcePool,clusterRpName);
        clusterSPs[i]=clusterSP;
        i++;
      }
    }
    logger.info("String_Node_Str");
    executeResourcePoolStoreProcedures(clusterSPs,"String_Node_Str",clusterName);
    int nodeGroupNameCount=countResult.get("String_Node_Str");
    Callable<Void>[] nodeGroupSPs=new Callable[nodeGroupNameCount];
    i=0;
    for (    Entry<String,List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap.entrySet()) {
      String vcClusterName=vcClusterRpNamesEntry.getKey();
      VcCluster vcCluster=VcResourceUtils.findVcCluster(vcClusterName);
      if (vcCluster == null) {
        String errorMsg="String_Node_Str" + vcClusterName + "String_Node_Str";
        logger.error(errorMsg);
        throw BddException.INTERNAL(null,errorMsg);
      }
      if (!vcCluster.getConfig().getDRSEnabled()) {
        continue;
      }
      List<String> resourcePoolNames=vcClusterRpNamesEntry.getValue();
      for (      String resourcePoolName : resourcePoolNames) {
        VcResourcePool parentVcResourcePool=null;
        String vcRPName=CommonUtil.isBlank(resourcePoolName) ? clusterRpName : resourcePoolName + "String_Node_Str" + clusterRpName;
        parentVcResourcePool=VcResourceUtils.findRPInVCCluster(vcClusterName,vcRPName);
        if (parentVcResourcePool == null) {
          String errorMsg="String_Node_Str" + vcRPName + "String_Node_Str"+ (CommonUtil.isBlank(resourcePoolName) ? "String_Node_Str" : "String_Node_Str" + resourcePoolName + "String_Node_Str")+ "String_Node_Str";
          logger.error(errorMsg);
          throw BddException.INTERNAL(null,errorMsg);
        }
        long rpHashCode=vcClusterName.hashCode() ^ (vcClusterName + resourcePoolName).hashCode();
        for (        NodeGroupCreate nodeGroup : rpNodeGroupsMap.get(rpHashCode)) {
          AuAssert.check(nodeGroup != null,"String_Node_Str");
          if (nodeGroup.getName().length() > 80) {
            throw ClusteringServiceException.GROUP_NAME_TOO_LONG(clusterName);
          }
          CreateResourcePoolSP nodeGroupSP=new CreateResourcePoolSP(parentVcResourcePool,nodeGroup.getName(),nodeGroup);
          nodeGroupSPs[i]=nodeGroupSP;
          i++;
        }
      }
    }
    logger.info("String_Node_Str");
    executeResourcePoolStoreProcedures(nodeGroupSPs,"String_Node_Str",clusterName);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
  return clusterRpName;
}