Program: 48407
Project: 48407
Buggy source:
private void placeVirtualGroup(IContainer container,ClusterCreate cluster,IPlacementPlanner planner,VirtualGroup vGroup,List<BaseNode> placedNodes,Map<String,List<String>> filteredHosts){
  String targetRack=null;
  if (vGroup.getGroupRacks() != null && GroupRacksType.SAMERACK.equals(vGroup.getGroupRacks().getType())) {
    AuAssert.check(vGroup.getGroupRacks().getRacks() != null && vGroup.getGroupRacks().getRacks().length == 1);
    targetRack=vGroup.getGroupRacks().getRacks()[0];
  }
  if (filteredHosts.containsKey(PlacementUtil.NO_DATASTORE_HOSTS)) {
    filteredHosts.remove(PlacementUtil.NO_DATASTORE_HOSTS);
    filteredHosts.remove(PlacementUtil.NO_DATASTORE_HOSTS_NODE_GROUP);
  }
  List<String> dsFilteredOutHosts=new ArrayList<String>();
  if (vGroup.getvNodes().size() != 0) {
    List<String> noDatastoreHosts=container.getDsFilteredOutHosts(vGroup);
    if (null != noDatastoreHosts && !noDatastoreHosts.isEmpty()) {
      filteredHosts.put(PlacementUtil.NO_DATASTORE_HOSTS,noDatastoreHosts);
      filteredHosts.put(PlacementUtil.NO_DATASTORE_HOSTS_NODE_GROUP,vGroup.getNodeGroupNames());
    }
  }
  for (  VirtualNode vNode : vGroup.getvNodes()) {
    logger.info("String_Node_Str" + vNode.getBaseNodeNames());
    List<AbstractHost> candidates=container.getValidHosts(vNode,targetRack);
    if (candidates == null || candidates.size() == 0) {
      logger.error("String_Node_Str" + "String_Node_Str" + vNode.getBaseNodeNames());
      throw PlacementException.OUT_OF_VC_HOST(PlacementUtil.getBaseNodeNames(vNode));
    }
    AbstractHost host=planner.selectHost(vNode,candidates);
    if (host == null) {
      logger.error("String_Node_Str" + candidates + "String_Node_Str"+ vNode.getBaseNodeNames());
      throw PlacementException.OUT_OF_VC_HOST(PlacementUtil.getBaseNodeNames(vNode));
    }
    for (    BaseNode baseNode : vNode.getBaseNodes()) {
      Pair<String,String> rpClusterPair=planner.selectVcRp(baseNode,host);
      String rack=container.getRack(host);
      baseNode.place(rack,rpClusterPair.first,rpClusterPair.second,host);
    }
    container.allocate(vNode,host);
    logger.info("String_Node_Str" + host);
    logger.info("String_Node_Str" + vNode);
    placedNodes.addAll(vNode.getBaseNodes());
  }
}

Fixed version (ground truth):
private void placeVirtualGroup(IContainer container,ClusterCreate cluster,IPlacementPlanner planner,VirtualGroup vGroup,List<BaseNode> placedNodes,Map<String,List<String>> filteredHosts){
  String targetRack=null;
  if (vGroup.getGroupRacks() != null && GroupRacksType.SAMERACK.equals(vGroup.getGroupRacks().getType())) {
    AuAssert.check(vGroup.getGroupRacks().getRacks() != null && vGroup.getGroupRacks().getRacks().length == 1);
    targetRack=vGroup.getGroupRacks().getRacks()[0];
  }
  if (filteredHosts.containsKey(PlacementUtil.NO_DATASTORE_HOSTS)) {
    filteredHosts.remove(PlacementUtil.NO_DATASTORE_HOSTS);
    filteredHosts.remove(PlacementUtil.NO_DATASTORE_HOSTS_NODE_GROUP);
  }
  if (vGroup.getvNodes().size() != 0) {
    List<String> noDatastoreHosts=container.getDsFilteredOutHosts(vGroup);
    if (null != noDatastoreHosts && !noDatastoreHosts.isEmpty()) {
      filteredHosts.put(PlacementUtil.NO_DATASTORE_HOSTS,noDatastoreHosts);
      filteredHosts.put(PlacementUtil.NO_DATASTORE_HOSTS_NODE_GROUP,vGroup.getNodeGroupNames());
    }
  }
  for (  VirtualNode vNode : vGroup.getvNodes()) {
    logger.info("String_Node_Str" + vNode.getBaseNodeNames());
    List<AbstractHost> candidates=container.getValidHosts(vNode,targetRack);
    if (candidates == null || candidates.size() == 0) {
      logger.error("String_Node_Str" + "String_Node_Str" + vNode.getBaseNodeNames());
      throw PlacementException.OUT_OF_VC_HOST(PlacementUtil.getBaseNodeNames(vNode));
    }
    AbstractHost host=planner.selectHost(vNode,candidates);
    if (host == null) {
      logger.error("String_Node_Str" + candidates + "String_Node_Str"+ vNode.getBaseNodeNames());
      throw PlacementException.OUT_OF_VC_HOST(PlacementUtil.getBaseNodeNames(vNode));
    }
    for (    BaseNode baseNode : vNode.getBaseNodes()) {
      Pair<String,String> rpClusterPair=planner.selectVcRp(baseNode,host);
      String rack=container.getRack(host);
      baseNode.place(rack,rpClusterPair.first,rpClusterPair.second,host);
    }
    container.allocate(vNode,host);
    logger.info("String_Node_Str" + host);
    logger.info("String_Node_Str" + vNode);
    placedNodes.addAll(vNode.getBaseNodes());
  }
}