Program: 48376
Project: 48376
Buggy source:
public AmClusterDef(ClusterBlueprint blueprint,String privateKey,String ambariServerVersion){
  this.name=blueprint.getName();
  this.version=blueprint.getHadoopStack().getFullVersion();
  this.verbose=true;
  this.sshKey=privateKey;
  this.user=Constants.AMBARI_SSH_USER;
  this.currentReport=new ClusterReport(blueprint);
  this.ambariServerVersion=ambariServerVersion;
  this.nodes=new ArrayList<AmNodeDef>();
  HdfsVersion hdfs=getDefaultHdfsVersion(this.version);
  if (blueprint.hasTopologyPolicy()) {
    setRackTopologyFileName(blueprint);
  }
  this.configurations=AmUtils.toAmConfigurations(blueprint.getConfiguration());
  for (  NodeGroupInfo group : blueprint.getNodeGroups()) {
    for (    NodeInfo node : group.getNodes()) {
      AmNodeDef nodeDef=new AmNodeDef();
      nodeDef.setName(node.getName());
      nodeDef.setIp(node.getMgtIpAddress());
      nodeDef.setFqdn(node.getHostname());
      nodeDef.setRackInfo(node.getRack());
      nodeDef.setConfigurations(AmUtils.toAmConfigurations(group.getConfiguration()));
      nodeDef.setComponents(group.getRoles());
      nodeDef.setVolumns(node.getVolumes(),hdfs,ambariServerVersion);
      this.nodes.add(nodeDef);
    }
  }
  if (blueprint.getExternalNamenode() != null) {
    this.isComputeOnly=true;
    this.externalNamenode=blueprint.getExternalNamenode();
    this.externalSecondaryNamenode=blueprint.getExternalSecondaryNamenode();
    AmNodeDef namenodeDef=new AmNodeDef();
    namenodeDef.setName(name + "String_Node_Str");
    namenodeDef.setFqdn(externalNamenode);
    List<String> namenodeRoles=new ArrayList<String>();
    namenodeRoles.add("String_Node_Str");
    if (!isValidExternalSecondaryNamenode()) {
      namenodeRoles.add("String_Node_Str");
    }
    namenodeDef.setComponents(namenodeRoles);
    this.nodes.add(namenodeDef);
    if (isValidExternalSecondaryNamenode()) {
      AmNodeDef secondaryNamenodeDef=new AmNodeDef();
      secondaryNamenodeDef.setName(name + "String_Node_Str");
      secondaryNamenodeDef.setFqdn(externalSecondaryNamenode);
      List<String> secondaryNamenodeRoles=new ArrayList<String>();
      secondaryNamenodeRoles.add("String_Node_Str");
      secondaryNamenodeDef.setComponents(secondaryNamenodeRoles);
      this.nodes.add(secondaryNamenodeDef);
    }
  }
  AmStackDef stackDef=new AmStackDef();
  stackDef.setName(blueprint.getHadoopStack().getVendor());
  stackDef.setVersion(blueprint.getHadoopStack().getFullVersion());
  this.amStack=stackDef;
}

Fixed version (ground truth):
public AmClusterDef(ClusterBlueprint blueprint,String privateKey,String ambariServerVersion){
  this.name=blueprint.getName();
  this.version=blueprint.getHadoopStack().getFullVersion();
  this.verbose=true;
  this.sshKey=privateKey;
  this.user=Constants.AMBARI_SSH_USER;
  this.currentReport=new ClusterReport(blueprint);
  this.ambariServerVersion=ambariServerVersion;
  this.nodes=new ArrayList<AmNodeDef>();
  HdfsVersion hdfs=getDefaultHdfsVersion(this.version);
  if (blueprint.hasTopologyPolicy()) {
    setRackTopologyFileName(blueprint);
  }
  setAdditionalConfigurations(blueprint,ambariServerVersion);
  this.configurations=AmUtils.toAmConfigurations(blueprint.getConfiguration());
  for (  NodeGroupInfo group : blueprint.getNodeGroups()) {
    for (    NodeInfo node : group.getNodes()) {
      AmNodeDef nodeDef=new AmNodeDef();
      nodeDef.setName(node.getName());
      nodeDef.setIp(node.getMgtIpAddress());
      nodeDef.setFqdn(node.getHostname());
      nodeDef.setRackInfo(node.getRack());
      nodeDef.setConfigurations(AmUtils.toAmConfigurations(group.getConfiguration()));
      nodeDef.setComponents(group.getRoles());
      nodeDef.setVolumns(node.getVolumes(),hdfs,ambariServerVersion);
      this.nodes.add(nodeDef);
    }
  }
  if (blueprint.getExternalNamenode() != null) {
    this.isComputeOnly=true;
    this.externalNamenode=blueprint.getExternalNamenode();
    this.externalSecondaryNamenode=blueprint.getExternalSecondaryNamenode();
    AmNodeDef namenodeDef=new AmNodeDef();
    namenodeDef.setName(name + "String_Node_Str");
    namenodeDef.setFqdn(externalNamenode);
    List<String> namenodeRoles=new ArrayList<String>();
    namenodeRoles.add("String_Node_Str");
    if (!isValidExternalSecondaryNamenode()) {
      namenodeRoles.add("String_Node_Str");
    }
    namenodeDef.setComponents(namenodeRoles);
    this.nodes.add(namenodeDef);
    if (isValidExternalSecondaryNamenode()) {
      AmNodeDef secondaryNamenodeDef=new AmNodeDef();
      secondaryNamenodeDef.setName(name + "String_Node_Str");
      secondaryNamenodeDef.setFqdn(externalSecondaryNamenode);
      List<String> secondaryNamenodeRoles=new ArrayList<String>();
      secondaryNamenodeRoles.add("String_Node_Str");
      secondaryNamenodeDef.setComponents(secondaryNamenodeRoles);
      this.nodes.add(secondaryNamenodeDef);
    }
  }
  AmStackDef stackDef=new AmStackDef();
  stackDef.setName(blueprint.getHadoopStack().getVendor());
  stackDef.setVersion(blueprint.getHadoopStack().getFullVersion());
  this.amStack=stackDef;
}