nus-yam/ex-repair huggingface dataset:
Program: 48931
Project: 48931
Buggy source:
/** 
 * Delete an object by id
 * @param id
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput utput callback
 */
public void deleteObject(final String id,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.DELETE) {
      ResponseEntity<String> response=restDelete(path,id);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.DELETE,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Delete an object by id
 * @param id
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput utput callback
 */
public void deleteObject(final String id,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.DELETE) {
      ResponseEntity<String> response=restDelete(path,id);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.DELETE,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48933
Project: 48933
Buggy source:
/** 
 * Generic method to get an object by id
 * @param id
 * @param entityType the object type
 * @param path the rest url
 * @param verb the http method
 * @param detail flag to retrieve detailed information or not
 * @return the object
 */
public <T>T getObject(final String id,Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGetById(path,id,entityType,detail);
      if (!validateAuthorization(response)) {
        return null;
      }
      T objectRead=response.getBody();
      return objectRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Generic method to get an object by id
 * @param id
 * @param entityType the object type
 * @param path the rest url
 * @param verb the http method
 * @param detail flag to retrieve detailed information or not
 * @return the object
 */
public <T>T getObject(final String id,Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGetById(path,id,entityType,detail);
      if (!validateAuthorization(response)) {
        return null;
      }
      T objectRead=response.getBody();
      return objectRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48934
Project: 48934
Buggy source:
/** 
 * Create an object through rest apis
 * @param entity the creation content
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput output callback
 */
public void createObject(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.POST) {
      ResponseEntity<String> response=restPost(path,entity);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.POST,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Create an object through rest apis
 * @param entity the creation content
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput output callback
 */
public void createObject(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.POST) {
      ResponseEntity<String> response=restPost(path,entity);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.POST,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48935
Project: 48935
Buggy source:
/** 
 * Method to get by path
 * @param entityType
 * @param path
 * @param verb
 * @param detail
 * @return
 */
public <T>T getObjectByPath(Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGet(path,entityType,detail);
      T objectRead=response.getBody();
      return objectRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Method to get by path
 * @param entityType
 * @param path
 * @param verb
 * @param detail
 * @return
 */
public <T>T getObjectByPath(Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGet(path,entityType,detail);
      T objectRead=response.getBody();
      return objectRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48936
Project: 48936
Buggy source:
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,clusteringService.getTemplateVmId(),clusteringService.getTemplateSnapId());
  NetworkAdd networkAdd=clusterSpec.getNetworking().get(0);
  Map<String,String> guestVariable=ClusteringService.getNetworkGuestVariable(networkAdd,node.getIpAddress(),node.getGuestHostName());
  VcVmUtil.addBootupUUID(guestVariable);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema);
  return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,null,guestVariable,false,getTargetFolder(node,clusterSpec.getNodeGroup(groupName)),getTargetHost(node));
}

Fixed version (ground truth):
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,clusteringService.getTemplateVmId(),Constants.ROOT_SNAPSTHOT_NAME);
  NetworkAdd networkAdd=clusterSpec.getNetworking().get(0);
  Map<String,String> guestVariable=ClusteringService.getNetworkGuestVariable(networkAdd,node.getIpAddress(),node.getGuestHostName());
  VcVmUtil.addBootupUUID(guestVariable);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema);
  return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,null,guestVariable,false,getTargetFolder(node,clusterSpec.getNodeGroup(groupName)),getTargetHost(node));
}
Program: 48937
Project: 48937
Buggy source:
private void snapshotTemplateVM(){
  final VcVirtualMachine templateVM=getTemplateVm();
  if (templateVM == null) {
    throw ClusteringServiceException.TEMPLATE_VM_NOT_FOUND();
  }
  try {
    final VcSnapshot snapshot=templateVM.getSnapshotByName(Constants.ROOT_SNAPSTHOT_NAME);
    if (snapshot == null) {
      if (!ConfigInfo.isJustUpgraded()) {
        TakeSnapshotSP snapshotSp=new TakeSnapshotSP(templateVM.getId(),Constants.ROOT_SNAPSTHOT_NAME,Constants.ROOT_SNAPSTHOT_DESC);
        snapshotSp.call();
        templateSnapId=snapshotSp.getSnapId();
      }
    }
 else {
      if (ConfigInfo.isJustUpgraded()) {
        VcContext.inVcSessionDo(new VcSession<Boolean>(){
          @Override protected boolean isTaskSession(){
            return true;
          }
          @Override protected Boolean body() throws Exception {
            snapshot.remove();
            return true;
          }
        }
);
        ConfigInfo.setJustUpgraded(false);
        ConfigInfo.save();
      }
 else {
        templateSnapId=snapshot.getName();
      }
    }
    this.templateVm=templateVM;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str");
    throw BddException.INTERNAL(e,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void snapshotTemplateVM(){
  final VcVirtualMachine templateVM=getTemplateVm();
  if (templateVM == null) {
    throw ClusteringServiceException.TEMPLATE_VM_NOT_FOUND();
  }
  try {
    if (ConfigInfo.isJustUpgraded()) {
      removeRootSnapshot(templateVM);
      ConfigInfo.setJustUpgraded(false);
      ConfigInfo.save();
    }
    this.templateVm=templateVM;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str");
    throw BddException.INTERNAL(e,"String_Node_Str");
  }
}
Program: 48938
Project: 48938
Buggy source:
private VmSchema getVmSchema(BaseNode vNode){
  VmSchema schema=vNode.getVmSchema();
  schema.diskSchema.setParent(getTemplateVmId());
  schema.diskSchema.setParentSnap(getTemplateSnapId());
  return schema;
}

Fixed version (ground truth):
private VmSchema getVmSchema(BaseNode vNode){
  VmSchema schema=vNode.getVmSchema();
  schema.diskSchema.setParent(getTemplateVmId());
  schema.diskSchema.setParentSnap(Constants.ROOT_SNAPSTHOT_NAME);
  return schema;
}
Program: 48940
Project: 48940
Buggy source:
public synchronized void init(){
  if (!initialized) {
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.ALLOWED);
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.FINALIZED);
    VcContext.initVcContext();
    new VcEventRouter();
    CmsWorker.addPeriodic(new VcInventory.SyncInventoryRequest());
    VcInventory.loadInventory();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
    new VcEventProcessor(getClusterEntityMgr());
    String poolSize=Configuration.getNonEmptyString("String_Node_Str");
    if (poolSize == null) {
      Scheduler.init(Constants.DEFAULT_SCHEDULER_POOL_SIZE,Constants.DEFAULT_SCHEDULER_POOL_SIZE);
    }
 else {
      Scheduler.init(Integer.parseInt(poolSize),Integer.parseInt(poolSize));
    }
    String concurrency=Configuration.getNonEmptyString("String_Node_Str");
    if (concurrency != null) {
      cloneConcurrency=Integer.parseInt(concurrency);
    }
 else {
      cloneConcurrency=1;
    }
    CmsWorker.addPeriodic(new ClusterNodeUpdator(getClusterEntityMgr()));
    snapshotTemplateVM();
    loadTemplateNetworkLable();
    convertTemplateVm();
    initialized=true;
  }
}

Fixed version (ground truth):
public synchronized void init(){
  if (!initialized) {
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.ALLOWED);
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.FINALIZED);
    VcContext.initVcContext();
    new VcEventRouter();
    CmsWorker.addPeriodic(new VcInventory.SyncInventoryRequest());
    VcInventory.loadInventory();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
    new VcEventProcessor(getClusterEntityMgr());
    String poolSize=Configuration.getNonEmptyString("String_Node_Str");
    if (poolSize == null) {
      Scheduler.init(Constants.DEFAULT_SCHEDULER_POOL_SIZE,Constants.DEFAULT_SCHEDULER_POOL_SIZE);
    }
 else {
      Scheduler.init(Integer.parseInt(poolSize),Integer.parseInt(poolSize));
    }
    String concurrency=Configuration.getNonEmptyString("String_Node_Str");
    if (concurrency != null) {
      cloneConcurrency=Integer.parseInt(concurrency);
    }
 else {
      cloneConcurrency=1;
    }
    CmsWorker.addPeriodic(new ClusterNodeUpdator(getClusterEntityMgr()));
    snapshotTemplateVM();
    loadTemplateNetworkLable();
    convertTemplateVm();
    clusterInitializerService.transformClusterStatus(ClusterStatus.PROVISIONING,ClusterStatus.PROVISION_ERROR);
    initialized=true;
  }
}
Program: 48941
Project: 48941
Buggy source:
public static void waitForManual(String clusterName,IExecutionService executionService){
  logger.info("String_Node_Str");
  Map<String,Object> sendParam=new HashMap<String,Object>();
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_VERSION,Constants.VHM_PROTOCOL_VERSION);
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_CLUSTER_NAME,clusterName);
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_RECEIVE_ROUTE_KEY,CommonUtil.getUUID());
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_ACTION,LimitInstruction.actionWaitForManual);
  Map<String,Object> ret=null;
  try {
    ret=executionService.execute(new VHMMessageTask(sendParam,null));
    if (!(Boolean)ret.get("String_Node_Str")) {
      String errorMessage=(String)ret.get("String_Node_Str");
      throw TaskException.EXECUTION_FAILED(errorMessage);
    }
  }
 catch (  Exception e) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + clusterName);
  }
}

Fixed version (ground truth):
public static void waitForManual(String clusterName,IExecutionService executionService){
  logger.info("String_Node_Str");
  Map<String,Object> sendParam=new HashMap<String,Object>();
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_VERSION,Constants.VHM_PROTOCOL_VERSION);
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_CLUSTER_NAME,clusterName);
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_RECEIVE_ROUTE_KEY,CommonUtil.getUUID());
  sendParam.put(Constants.SET_MANUAL_ELASTICITY_INFO_ACTION,LimitInstruction.actionWaitForManual);
  Map<String,Object> ret=null;
  try {
    ret=executionService.execute(new VHMMessageTask(sendParam,null));
    if (!(Boolean)ret.get("String_Node_Str")) {
      String errorMessage=(String)ret.get("String_Node_Str");
      throw TaskException.EXECUTION_FAILED(errorMessage);
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName);
  }
}
Program: 48942
Project: 48942
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void conn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName){
  Map<String,String> loginInfo=new HashMap<String,String>();
  String username=null;
  String password=null;
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  Exception e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void conn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName){
  if (!validateHostPort(hostName)) {
    return;
  }
  Map<String,String> loginInfo=new HashMap<String,String>();
  String username=null;
  String password=null;
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  Exception e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
}
Program: 48943
Project: 48943
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void loggedConn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String username,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String password){
  Map<String,String> loginInfo=new HashMap<String,String>();
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  Exception e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void loggedConn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String username,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String password){
  if (!validateHostPort(hostName)) {
    return;
  }
  Map<String,String> loginInfo=new HashMap<String,String>();
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  Exception e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
}
Program: 48944
Project: 48944
Buggy source:
@Override public boolean isNetworkExistInVc(String networkName) throws VcProviderException {
  boolean result=false;
  VcNetwork network=VcResourceUtils.findNetworkInVC(networkName);
  if (network != null) {
    result=true;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean isNetworkExistInVc(String networkName) throws VcProviderException {
  boolean result=false;
  refreshNetwork();
  VcNetwork network=VcResourceUtils.findNetworkInVC(networkName);
  if (network != null) {
    result=true;
  }
  return result;
}
Program: 48945
Project: 48945
Buggy source:
@Override public boolean isNetworkSharedInCluster(String networkName,String clusterName) throws VcProviderException {
  boolean result=true;
  VcNetwork vcNetwork=getNetworkByName(networkName);
  if (vcNetwork == null) {
    return false;
  }
 else {
    String portGroupName=vcNetwork.getName();
    List<VcHost> hosts=getHostsByClusterName(clusterName);
    for (    VcHost vcHost : hosts) {
      List<VcNetwork> networks=vcHost.getNetworks();
      boolean found=false;
      for (      VcNetwork network : networks) {
        if (network.getName().equals(portGroupName)) {
          found=true;
          break;
        }
      }
      if (!found) {
        logger.error("String_Node_Str" + vcHost + "String_Node_Str"+ networks+ "String_Node_Str"+ portGroupName);
        result=false;
        break;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean isNetworkSharedInCluster(String networkName,String clusterName) throws VcProviderException {
  boolean result=true;
  refreshNetwork();
  VcNetwork vcNetwork=getNetworkByName(networkName);
  if (vcNetwork == null) {
    return false;
  }
 else {
    String portGroupName=vcNetwork.getName();
    List<VcHost> hosts=getHostsByClusterName(clusterName);
    for (    VcHost vcHost : hosts) {
      List<VcNetwork> networks=vcHost.getNetworks();
      boolean found=false;
      for (      VcNetwork network : networks) {
        if (network.getName().equals(portGroupName)) {
          found=true;
          break;
        }
      }
      if (!found) {
        logger.error("String_Node_Str" + vcHost + "String_Node_Str"+ networks+ "String_Node_Str"+ portGroupName);
        result=false;
        break;
      }
    }
  }
  return result;
}
Program: 48946
Project: 48946
Buggy source:
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,clusteringService.getTemplateVmId(),clusteringService.getTemplateSnapId());
  NetworkAdd networkAdd=clusterSpec.getNetworking().get(0);
  Map<String,String> guestVariable=ClusteringService.getNetworkGuestVariable(networkAdd,node.getIpAddress(),node.getGuestHostName());
  VcVmUtil.addBootupUUID(guestVariable);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),fullDiskSet);
  QueryIpAddress query=new QueryIpAddress(Constants.VM_POWER_ON_WAITING_SEC);
  return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,query,guestVariable,false,getTargetFolder(node,clusterSpec.getNodeGroup(groupName)),getTargetHost(node));
}

Fixed version (ground truth):
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,clusteringService.getTemplateVmId(),clusteringService.getTemplateSnapId());
  NetworkAdd networkAdd=clusterSpec.getNetworking().get(0);
  Map<String,String> guestVariable=ClusteringService.getNetworkGuestVariable(networkAdd,node.getIpAddress(),node.getGuestHostName());
  VcVmUtil.addBootupUUID(guestVariable);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),fullDiskSet,createSchema.networkSchema);
  QueryIpAddress query=new QueryIpAddress(Constants.VM_POWER_ON_WAITING_SEC);
  return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,query,guestVariable,false,getTargetFolder(node,clusterSpec.getNodeGroup(groupName)),getTargetHost(node));
}
Program: 48947
Project: 48947
Buggy source:
@Override public Void call() throws Exception {
  final VcVirtualMachine oldVm=VcCache.getIgnoreMissing(oldVmId);
  if (oldVm == null) {
    logger.info("String_Node_Str" + oldVmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      logger.info("String_Node_Str");
      OptionValue[] optionValues=getVhmExtraConfigs(oldVm);
      if (optionValues.length != 0) {
        ConfigSpec spec=new ConfigSpecImpl();
        spec.setExtraConfig(optionValues);
        vm.reconfigure(spec);
      }
      logger.info("String_Node_Str");
      destroyVm(oldVm);
      logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ newName);
      vm.rename(newName);
      logger.info("String_Node_Str");
      if (!Priority.NORMAL.equals(ioShares)) {
        VcVmUtil.configIOShares(oldVmId,ioShares);
      }
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  final VcVirtualMachine oldVm=VcCache.getIgnoreMissing(oldVmId);
  if (oldVm == null) {
    logger.info("String_Node_Str" + oldVmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      logger.info("String_Node_Str");
      copyNicSettings(oldVm);
      logger.info("String_Node_Str");
      OptionValue[] optionValues=getVhmExtraConfigs(oldVm);
      if (optionValues.length != 0) {
        ConfigSpec spec=new ConfigSpecImpl();
        spec.setExtraConfig(optionValues);
        vm.reconfigure(spec);
      }
      logger.info("String_Node_Str");
      destroyVm(oldVm);
      logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ newName);
      vm.rename(newName);
      logger.info("String_Node_Str");
      if (!Priority.NORMAL.equals(ioShares)) {
        VcVmUtil.configIOShares(oldVmId,ioShares);
      }
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}
Program: 48948
Project: 48948
Buggy source:
private void destroyVm(VcVirtualMachine oldVm) throws Exception {
  FaultToleranceConfigInfo info=oldVm.getConfig().getFtInfo();
  if (info != null && info.getRole() == 1) {
    logger.info("String_Node_Str" + oldVm.getName() + "String_Node_Str");
    oldVm.turnOffFT();
  }
  if (oldVm.isPoweredOn() && !oldVm.shutdownGuest(Constants.VM_FAST_SHUTDOWN_WAITING_SEC * 1000)) {
    oldVm.powerOff();
  }
  for (  DiskSpec disk : fullDiskSet) {
    if (disk.getVmdkPath() != null && !disk.getVmdkPath().isEmpty()) {
      oldVm.detachVirtualDisk(new DeviceId(disk.getExternalAddress()),false);
    }
  }
  try {
    oldVm.destroy(false);
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + oldVm.getName() + "String_Node_Str"+ e.getMessage());
    logger.info("String_Node_Str");
    oldVm.unregister();
  }
  logger.info("String_Node_Str" + oldVm.getName() + "String_Node_Str");
}

Fixed version (ground truth):
private void destroyVm(VcVirtualMachine oldVm) throws Exception {
  FaultToleranceConfigInfo info=oldVm.getConfig().getFtInfo();
  if (info != null && info.getRole() == 1) {
    logger.info("String_Node_Str" + oldVm.getName() + "String_Node_Str");
    oldVm.turnOffFT();
  }
  if (oldVm.isPoweredOn() && !oldVm.shutdownGuest(Constants.VM_FAST_SHUTDOWN_WAITING_SEC * 1000)) {
    oldVm.powerOff();
  }
  try {
    for (    DiskSpec disk : fullDiskSet) {
      if (disk.getVmdkPath() != null && !disk.getVmdkPath().isEmpty()) {
        oldVm.detachVirtualDisk(new DeviceId(disk.getExternalAddress()),false);
      }
    }
    oldVm.destroy(false);
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + oldVm.getName() + "String_Node_Str"+ e.getMessage());
    logger.info("String_Node_Str");
    oldVm.unregister();
  }
  logger.info("String_Node_Str" + oldVm.getName() + "String_Node_Str");
}
Program: 48949
Project: 48949
Buggy source:
public ReplaceVmPrePowerOn(String vmId,String newName,Priority ioShares,List<DiskSpec> fullDiskSet){
  this.oldVmId=vmId;
  this.newName=newName;
  this.ioShares=ioShares;
  this.fullDiskSet=fullDiskSet;
}

Fixed version (ground truth):
public ReplaceVmPrePowerOn(String vmId,String newName,Priority ioShares,List<DiskSpec> fullDiskSet,NetworkSchema networkSchema){
  this.oldVmId=vmId;
  this.newName=newName;
  this.ioShares=ioShares;
  this.fullDiskSet=fullDiskSet;
  this.networkSchema=networkSchema;
}
Program: 48950
Project: 48950
Buggy source:
@Override protected Void body() throws Exception {
  logger.info("String_Node_Str");
  OptionValue[] optionValues=getVhmExtraConfigs(oldVm);
  if (optionValues.length != 0) {
    ConfigSpec spec=new ConfigSpecImpl();
    spec.setExtraConfig(optionValues);
    vm.reconfigure(spec);
  }
  logger.info("String_Node_Str");
  destroyVm(oldVm);
  logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ newName);
  vm.rename(newName);
  logger.info("String_Node_Str");
  if (!Priority.NORMAL.equals(ioShares)) {
    VcVmUtil.configIOShares(oldVmId,ioShares);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  logger.info("String_Node_Str");
  copyNicSettings(oldVm);
  logger.info("String_Node_Str");
  OptionValue[] optionValues=getVhmExtraConfigs(oldVm);
  if (optionValues.length != 0) {
    ConfigSpec spec=new ConfigSpecImpl();
    spec.setExtraConfig(optionValues);
    vm.reconfigure(spec);
  }
  logger.info("String_Node_Str");
  destroyVm(oldVm);
  logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ newName);
  vm.rename(newName);
  logger.info("String_Node_Str");
  if (!Priority.NORMAL.equals(ioShares)) {
    VcVmUtil.configIOShares(oldVmId,ioShares);
  }
  return null;
}
Program: 48952
Project: 48952
Buggy source:
public static void prettyJsonOutput(Object object,String fileName) throws JsonParseException, JsonMappingException, IOException {
  OutputStream out=null;
  if (fileName != null) {
    out=new FileOutputStream(fileName);
  }
 else {
    out=System.out;
  }
  JsonFactory factory=new JsonFactory();
  JsonGenerator generator=factory.createJsonGenerator(out);
  ObjectMapper mapper=getMapper();
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  generator.setCodec(mapper);
  DefaultPrettyPrinter prettyPrinter=new DefaultPrettyPrinter();
  Indenter indenter=new Lf2SpacesIndenter();
  prettyPrinter.indentArraysWith(indenter);
  generator.setPrettyPrinter(prettyPrinter);
  generator.writeObject(object);
}

Fixed version (ground truth):
public static void prettyJsonOutput(Object object,String fileName) throws JsonParseException, JsonMappingException, IOException {
  OutputStream out=null;
  if (fileName != null) {
    out=new FileOutputStream(fileName);
  }
 else {
    out=System.out;
  }
  JsonFactory factory=new JsonFactory();
  JsonGenerator generator=factory.createJsonGenerator(out);
  ObjectMapper mapper=getMapper();
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  generator.setCodec(mapper);
  DefaultPrettyPrinter prettyPrinter=new DefaultPrettyPrinter();
  Indenter indenter=new Lf2SpacesIndenter();
  prettyPrinter.indentArraysWith(indenter);
  generator.setPrettyPrinter(prettyPrinter);
  generator.writeObject(object);
  if (fileName == null) {
    System.out.println();
  }
 else {
    File file=new File(fileName);
    System.out.println("String_Node_Str" + file.getAbsolutePath());
  }
}
Program: 48953
Project: 48953
Buggy source:
public boolean isSpecFile(){
  return specFile;
}

Fixed version (ground truth):
@JsonIgnore public boolean isSpecFile(){
  return specFile;
}
Program: 48955
Project: 48955
Buggy source:
/** 
 * Check if any compute only node group exists.
 */
public boolean containsComputeOnlyNodeGroups(){
  int count=0;
  for (  NodeGroupCreate nodeGroup : this.getNodeGroups()) {
    if (nodeGroup.getRoles() != null && nodeGroup.getRoles().contains(HadoopRole.HADOOP_TASKTRACKER.toString()) && (nodeGroup.getRoles().size() == 1 || (nodeGroup.getRoles().size() == 2 && nodeGroup.getRoles().contains(HadoopRole.TEMPFS_CLIENT_ROLE.toString())))) {
      count++;
    }
  }
  return count != 0 ? true : false;
}

Fixed version (ground truth):
/** 
 * Check if any compute only node group exists.
 */
public boolean containsComputeOnlyNodeGroups(){
  for (  NodeGroupCreate nodeGroup : this.getNodeGroups()) {
    if (CommonUtil.isComputeOnly(nodeGroup.getRoles(),distroVendor)) {
      return true;
    }
  }
  return false;
}
Program: 48956
Project: 48956
Buggy source:
public boolean validateSetManualElasticity(List<String>... nodeGroupNames){
  List<NodeGroupRead> nodeGroups=getNodeGroups();
  if (nodeGroups != null && !nodeGroups.isEmpty()) {
    int count=0;
    for (    NodeGroupRead nodeGroup : getNodeGroups()) {
      boolean isComputeOnly=false;
      if (distroVendor.equalsIgnoreCase(Constants.MAPR_VENDOR)) {
        if (nodeGroup.getRoles() != null && nodeGroup.getRoles().contains(HadoopRole.MAPR_TASKTRACKER_ROLE.toString()) && !nodeGroup.getRoles().contains(HadoopRole.MAPR_NFS_ROLE.toString())) {
          isComputeOnly=true;
        }
      }
 else {
        if (nodeGroup.getRoles() != null && nodeGroup.getRoles().contains(HadoopRole.HADOOP_TASKTRACKER.toString()) && (nodeGroup.getRoles().size() == 1 || (nodeGroup.getRoles().size() == 2 && nodeGroup.getRoles().contains(HadoopRole.TEMPFS_CLIENT_ROLE.toString())))) {
          isComputeOnly=true;
        }
      }
      if (isComputeOnly) {
        if (nodeGroupNames != null && nodeGroupNames.length > 0) {
          nodeGroupNames[0].add(nodeGroup.getName());
        }
        count++;
      }
    }
    if (count == 0) {
      return false;
    }
  }
 else {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean validateSetManualElasticity(List<String>... nodeGroupNames){
  List<NodeGroupRead> nodeGroups=getNodeGroups();
  if (nodeGroups != null && !nodeGroups.isEmpty()) {
    int count=0;
    for (    NodeGroupRead nodeGroup : getNodeGroups()) {
      if (CommonUtil.isComputeOnly(nodeGroup.getRoles(),distroVendor)) {
        if (nodeGroupNames != null && nodeGroupNames.length > 0) {
          nodeGroupNames[0].add(nodeGroup.getName());
        }
        count++;
      }
    }
    if (count == 0) {
      return false;
    }
  }
 else {
    return false;
  }
  return true;
}
Program: 48959
Project: 48959
Buggy source:
/** 
 * Set auto elasticity
 * @param clusterName
 * @return
 */
public boolean setAutoElasticity(String clusterName);

Fixed version (ground truth):
/** 
 * Set auto elasticity
 * @param clusterName
 * @return
 */
public boolean setAutoElasticity(String clusterName,boolean refreshAllNodes);
Program: 48961
Project: 48961
Buggy source:
private void setAutoFlag(boolean isReset){
  ClusterEntity clusterEntity=clusterEntityMgr.findByName(clusterName);
  Boolean value=null;
  if (!isReset) {
    preAutoFlag=clusterEntity.getAutomationEnable();
    if (preAutoFlag == null || !preAutoFlag) {
      return;
    }
    value=false;
    logger.info("String_Node_Str");
  }
 else {
    if (clusterEntity.getAutomationEnable() == preAutoFlag) {
      return;
    }
    value=preAutoFlag;
    logger.info("String_Node_Str" + preAutoFlag);
  }
  clusterEntity.setAutomationEnable(value);
  clusterEntityMgr.update(clusterEntity);
  if (!clusteringService.setAutoElasticity(clusterName)) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + clusterName);
  }
}

Fixed version (ground truth):
private void setAutoFlag(boolean isReset){
  ClusterEntity clusterEntity=clusterEntityMgr.findByName(clusterName);
  Boolean value=null;
  if (!isReset) {
    preAutoFlag=clusterEntity.getAutomationEnable();
    if (preAutoFlag == null || !preAutoFlag) {
      return;
    }
    value=false;
    logger.info("String_Node_Str");
  }
 else {
    if (clusterEntity.getAutomationEnable() == preAutoFlag) {
      return;
    }
    value=preAutoFlag;
    logger.info("String_Node_Str" + preAutoFlag);
  }
  clusterEntity.setAutomationEnable(value);
  clusterEntityMgr.update(clusterEntity);
  if (!clusteringService.setAutoElasticity(clusterName,false)) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + clusterName);
  }
}
Program: 48962
Project: 48962
Buggy source:
private void updateVhmMasterMoid(String clusterName){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  if (cluster.getVhmMasterMoid() == null) {
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    for (    NodeEntity node : nodes) {
      if (node.getMoId() != null && node.getNodeGroup().getRoles() != null) {
        @SuppressWarnings("String_Node_Str") List<String> roles=new Gson().fromJson(node.getNodeGroup().getRoles(),List.class);
        if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
          cluster.setVhmMasterMoid(node.getMoId());
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateVhmMasterMoid(String clusterName){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  if (cluster.getVhmMasterMoid() == null) {
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    for (    NodeEntity node : nodes) {
      if (node.getMoId() != null && node.getNodeGroup().getRoles() != null) {
        @SuppressWarnings("String_Node_Str") List<String> roles=new Gson().fromJson(node.getNodeGroup().getRoles(),List.class);
        if (cluster.getDistro().equalsIgnoreCase(Constants.MAPR_VENDOR)) {
          if (roles.contains(HadoopRole.MAPR_JOBTRACKER_ROLE.toString())) {
            cluster.setVhmMasterMoid(node.getMoId());
            break;
          }
        }
 else {
          if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
            cluster.setVhmMasterMoid(node.getMoId());
            break;
          }
        }
      }
    }
  }
}
Program: 48963
Project: 48963
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  boolean success=clusteringService.setAutoElasticity(clusterName);
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXISTING_NODES_JOB_PARAM,success);
  if (!success) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + clusterName + "String_Node_Str");
  }
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  boolean success=clusteringService.setAutoElasticity(clusterName,refreshAllNodes);
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXISTING_NODES_JOB_PARAM,success);
  if (!success) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + clusterName + "String_Node_Str");
  }
  return RepeatStatus.FINISHED;
}
Program: 48964
Project: 48964
Buggy source:
private boolean diableAutoEalsticity(String clusterName){
  AuAssert.check(clusteringService != null);
  AuAssert.check(clusterEntityManager != null);
  ClusterEntity clusterEntity=clusterEntityManager.findByName(clusterName);
  if (clusterEntity.getAutomationEnable() == null || !clusterEntity.getAutomationEnable()) {
    return true;
  }
  clusterEntity.setAutomationEnable(false);
  clusterEntityManager.update(clusterEntity);
  return clusteringService.setAutoElasticity(clusterName);
}

Fixed version (ground truth):
private boolean diableAutoEalsticity(String clusterName){
  AuAssert.check(clusteringService != null);
  AuAssert.check(clusterEntityManager != null);
  ClusterEntity clusterEntity=clusterEntityManager.findByName(clusterName);
  if (clusterEntity.getAutomationEnable() == null || !clusterEntity.getAutomationEnable()) {
    return true;
  }
  clusterEntity.setAutomationEnable(false);
  clusterEntityManager.update(clusterEntity);
  return clusteringService.setAutoElasticity(clusterName,false);
}
Program: 48967
Project: 48967
Buggy source:
@Override protected Void body() throws Exception {
  List<OptionValue> options=new ArrayList<OptionValue>();
  if (vm.getId().equalsIgnoreCase(masterMoId)) {
    options.add(new OptionValueImpl("String_Node_Str",enableAutoElasticity.toString()));
    options.add(new OptionValueImpl("String_Node_Str",(new Integer(minComputeNodeNum)).toString()));
    options.add(new OptionValueImpl("String_Node_Str",jobTrackerPort));
  }
  options.add(new OptionValueImpl("String_Node_Str",masterMoId.split("String_Node_Str")[2]));
  options.add(new OptionValueImpl("String_Node_Str",masterUUID));
  options.add(new OptionValueImpl("String_Node_Str",serengetiUUID));
  options.add(new OptionValueImpl("String_Node_Str",(new Boolean(isComputeOnlyNode)).toString()));
  OptionValue[] optionValues=options.toArray((OptionValue[])Array.newInstance(OptionValue.class,options.size()));
  ConfigSpec spec=new ConfigSpecImpl();
  spec.setExtraConfig(optionValues);
  vm.reconfigure(spec);
  logger.info("String_Node_Str" + masterMoId + "String_Node_Str"+ masterUUID+ "String_Node_Str"+ isComputeOnlyNode+ "String_Node_Str"+ enableAutoElasticity+ "String_Node_Str"+ jobTrackerPort+ "String_Node_Str"+ minComputeNodeNum);
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  List<OptionValue> options=new ArrayList<OptionValue>();
  if (vm.getId().equalsIgnoreCase(masterMoId)) {
    options.add(new OptionValueImpl(VHMConstants.VHM_ENABLE,enableAutoElasticity.toString()));
    options.add(new OptionValueImpl(VHMConstants.VHM_MIN_COMPUTENODE_NUM,(new Integer(minComputeNodeNum)).toString()));
    options.add(new OptionValueImpl(VHMConstants.VHM_JOBTRACKER_PORT,jobTrackerPort));
  }
  options.add(new OptionValueImpl(VHMConstants.VHM_MASTER_MOID,masterMoId.split("String_Node_Str")[2]));
  options.add(new OptionValueImpl(VHMConstants.VHM_MASTER_UUID,masterUUID));
  options.add(new OptionValueImpl(VHMConstants.VHM_SERENGETI_UUID,serengetiUUID));
  options.add(new OptionValueImpl(VHMConstants.VHM_ELASTIC,(new Boolean(isComputeOnlyNode)).toString()));
  OptionValue[] optionValues=options.toArray((OptionValue[])Array.newInstance(OptionValue.class,options.size()));
  ConfigSpec spec=new ConfigSpecImpl();
  spec.setExtraConfig(optionValues);
  vm.reconfigure(spec);
  logger.info("String_Node_Str" + masterMoId + "String_Node_Str"+ masterUUID+ "String_Node_Str"+ isComputeOnlyNode+ "String_Node_Str"+ enableAutoElasticity+ "String_Node_Str"+ jobTrackerPort+ "String_Node_Str"+ minComputeNodeNum);
  return null;
}
Program: 48969
Project: 48969
Buggy source:
public void validateCDHVersion(List<String> warningMsgList){
  if (this.getDistroVendor().equalsIgnoreCase(Constants.CDH_VENDOR) && (compare(this.getDistroVersion(),"String_Node_Str") > 0)) {
    warningMsgList.add(Constants.MUST_CONFIGURE_FQDN);
  }
}

Fixed version (ground truth):
public void validateCDHVersion(List<String> warningMsgList){
  if (this.getDistroVendor().equalsIgnoreCase(Constants.CDH_VENDOR)) {
    Pattern pattern=Pattern.compile(Constants.CDH4_PATTERN);
    if (!pattern.matcher(this.getDistroVersion()).matches()) {
      return;
    }
    if (compare(this.getDistroVersion(),"String_Node_Str") > 0) {
      warningMsgList.add(Constants.MUST_CONFIGURE_FQDN);
    }
  }
}
Program: 48970
Project: 48970
Buggy source:
@Test public void testValidateCDHVersion(){
  List<String> warningMsgList=new LinkedList<String>();
  ClusterCreate cluster=new ClusterCreate();
  cluster.setDistroVendor(Constants.CDH_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 1);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 1);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
}

Fixed version (ground truth):
@Test public void testValidateCDHVersion(){
  List<String> warningMsgList=new LinkedList<String>();
  ClusterCreate cluster=new ClusterCreate();
  cluster.setDistroVendor(Constants.CDH_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 1);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 1);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  warningMsgList.clear();
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
  cluster.setDistroVersion("String_Node_Str");
  cluster.validateCDHVersion(warningMsgList);
  assertEquals(true,warningMsgList.size() == 0);
}
Program: 48971
Project: 48971
Buggy source:
@Override public void allocate(VirtualNode vNode,AbstractHost host){
  for (  BaseNode node : vNode.getBaseNodes()) {
    this.dc.getDatastore(node.getTargetDs()).allocate(node.getSystemDiskSize());
    for (    Disk disk : node.getVmSchema().diskSchema.getDisks()) {
      this.dc.getDatastore(disk.datastore).allocate(disk.initialSizeMB / 1024);
    }
  }
}

Fixed version (ground truth):
@Override public void allocate(VirtualNode vNode,AbstractHost host){
  for (  BaseNode node : vNode.getBaseNodes()) {
    for (    DiskSpec disk : node.getDisks()) {
      this.dc.getDatastore(disk.getTargetDs()).allocate(disk.getSize());
    }
  }
}
Program: 48973
Project: 48973
Buggy source:
/** 
 * copy parent vm's configurations, includes vApp configs, hardware version info
 */
private void copyParentVmSettings(VcVirtualMachine template,ConfigSpec configSpec){
  configSpec.setName(newVmName);
  VmConfigInfo configInfo=template.getConfig().getVAppConfig();
  VmConfigSpec vAppSpec=new VmConfigSpecImpl();
  vAppSpec.setOvfEnvironmentTransport(configInfo.getOvfEnvironmentTransport());
  List<ProductSpec> productSpecs=new ArrayList<ProductSpec>();
  for (  ProductInfo info : configInfo.getProduct()) {
    ProductSpec spec=new ProductSpecImpl();
    spec.setInfo(info);
    spec.setOperation(Operation.add);
    productSpecs.add(spec);
  }
  vAppSpec.setProduct(productSpecs.toArray(new ProductSpec[productSpecs.size()]));
  configSpec.setVAppConfig(vAppSpec);
  configSpec.setGuestId(template.getConfig().getGuestId());
  configSpec.setVersion(template.getConfig().getVersion());
}

Fixed version (ground truth):
/** 
 * copy parent vm's configurations, includes vApp configs, hardware version info
 */
private void copyParentVmSettings(VcVirtualMachine template,ConfigSpec configSpec){
  configSpec.setName(newVmName);
  configSpec.setGuestId(template.getConfig().getGuestId());
  configSpec.setVersion(template.getConfig().getVersion());
  VmConfigInfo configInfo=template.getConfig().getVAppConfig();
  if (configInfo == null) {
    return;
  }
  VmConfigSpec vAppSpec=new VmConfigSpecImpl();
  vAppSpec.setOvfEnvironmentTransport(configInfo.getOvfEnvironmentTransport());
  List<ProductSpec> productSpecs=new ArrayList<ProductSpec>();
  for (  ProductInfo info : configInfo.getProduct()) {
    ProductSpec spec=new ProductSpecImpl();
    spec.setInfo(info);
    spec.setOperation(Operation.add);
    productSpecs.add(spec);
  }
  vAppSpec.setProduct(productSpecs.toArray(new ProductSpec[productSpecs.size()]));
  configSpec.setVAppConfig(vAppSpec);
}