nus-yam/ex-repair huggingface dataset:
Program: 48782
Project: 48782
Buggy source:
private Folder getTargetFolder(NodeEntity node,NodeGroupCreate nodeGroup){
  VcVirtualMachine vm=VcCache.get(node.getMoId());
  String folderPath=nodeGroup.getVmFolderPath();
  List<String> folderNames=Arrays.asList(folderPath.split("String_Node_Str"));
  AuAssert.check(!folderNames.isEmpty());
  return VcResourceUtils.findFolderByNameList(vm.getDatacenter(),folderNames);
}

Fixed version (ground truth):
private Folder getTargetFolder(NodeEntity node){
  VcVirtualMachine vm=VcCache.get(node.getMoId());
  return vm.getParentFolder();
}
Program: 48784
Project: 48784
Buggy source:
private void refreshNodeWithAction(Event e,String moId,boolean setAction,String action,String eventName) throws Exception {
  VcVirtualMachine vm=VcCache.getIgnoreMissing(e.getVm().getVm());
  if (vm == null) {
    return;
  }
  if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
    logger.info("String_Node_Str" + eventName + "String_Node_Str"+ vm.getName());
    vm.updateRuntime();
    if (setAction) {
      clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),action,true);
    }
 else {
      clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),true);
    }
  }
  return;
}

Fixed version (ground truth):
private void refreshNodeWithAction(String moId,boolean setAction,String action,String eventName) throws Exception {
  VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
  if (vm == null) {
    return;
  }
  if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
    logger.info("String_Node_Str" + eventName + "String_Node_Str"+ vm.getName());
    vm.updateRuntime();
    if (setAction) {
      clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),action,true);
    }
 else {
      clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),true);
    }
  }
  return;
}
Program: 48785
Project: 48785
Buggy source:
private boolean processExternalEvent(VcEventType type,Event e,String moId) throws Exception {
  if (clusterEntityMgr.getNodeByMobId(moId) != null) {
    return true;
  }
  if (type != VcEventType.VmRemoved) {
    VcVirtualMachine vm=VcCache.getIgnoreMissing(e.getVm().getVm());
    if (vm == null) {
      return false;
    }
    logger.debug("String_Node_Str");
    if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null && VcResourceUtils.insidedRootFolder(vm)) {
      logger.info("String_Node_Str" + vm.getName() + "String_Node_Str");
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean processExternalEvent(VcEventType type,Event e,String moId) throws Exception {
  if (clusterEntityMgr.getNodeByMobId(moId) != null) {
    return true;
  }
  if (type != VcEventType.VmRemoved) {
    VcVirtualMachine vm=VcCache.getIgnoreMissing(e.getVm().getVm());
    if (vm == null) {
      return false;
    }
    logger.debug("String_Node_Str");
    if (rootSerengetiFolder == null) {
      initRootFolder();
    }
    if (rootSerengetiFolder == null) {
      return false;
    }
    if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null && VcResourceUtils.insidedRootFolder(rootSerengetiFolder,vm)) {
      logger.info("String_Node_Str" + vm.getName() + "String_Node_Str");
      return true;
    }
  }
  return false;
}
Program: 48786
Project: 48786
Buggy source:
public static boolean insidedRootFolder(VcVirtualMachine vm){
  String root=ConfigInfo.getSerengetiRootFolder();
  List<String> folderNames=new ArrayList<String>();
  folderNames.add(root);
  String[] split=vm.getName().split("String_Node_Str");
  AuAssert.check(split != null && split.length == 3);
  folderNames.add(split[0]);
  folderNames.add(split[1]);
  Folder folder=null;
  try {
    folder=VcResourceUtils.findFolderByNameList(vm.getDatacenter(),folderNames);
  }
 catch (  Exception e) {
    logger.debug("String_Node_Str",e);
  }
  if (folder != null) {
    return VcResourceUtils.isObjectInFolder(folder,vm.getId());
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public static boolean insidedRootFolder(final Folder rootFolder,final VcVirtualMachine vm){
  String[] split=vm.getName().split("String_Node_Str");
  if (split == null || split.length != 3) {
    logger.debug("String_Node_Str");
    return false;
  }
  final String groupFolderName=split[1];
  final String clusterFolderName=split[0];
  return VcContext.inVcSessionDo(new VcSession<Boolean>(){
    @Override protected Boolean body() throws Exception {
      try {
        Folder groupFolder=vm.getParentFolder();
        if (groupFolder == null || groupFolder.getName() == null || !groupFolder.getName().equals(groupFolderName)) {
          logger.debug("String_Node_Str");
          return false;
        }
        ManagedObjectReference mo=groupFolder.getParent();
        if (mo == null) {
          logger.debug("String_Node_Str");
          return false;
        }
        Folder clusterFolder=MoUtil.getManagedObject(mo);
        if (clusterFolder == null || clusterFolder.getName() == null || !clusterFolder.getName().equals(clusterFolderName)) {
          logger.debug("String_Node_Str");
          return false;
        }
        mo=clusterFolder.getParent();
        if (mo == null) {
          logger.debug("String_Node_Str");
          return false;
        }
        if (MoUtil.morefToString(mo).equals(MoUtil.morefToString(rootFolder._getRef()))) {
          return true;
        }
      }
 catch (      Exception e) {
        logger.info("String_Node_Str",e);
      }
      return false;
    }
  }
);
}
Program: 48788
Project: 48788
Buggy source:
public SetAutoElasticitySP(VcVirtualMachine vcVm,String serengetiUUID,String masterMoId,String masterUUID,Boolean enableAutoElasticity,int minComputeNodeNum,int maxComputeNodeNum,String jobTrackerPort,boolean isComputeOnlyNode){
  this.vcVm=vcVm;
  this.serengetiUUID=serengetiUUID;
  this.masterMoId=masterMoId;
  this.masterUUID=masterUUID;
  this.enableAutoElasticity=enableAutoElasticity;
  this.minComputeNodeNum=minComputeNodeNum;
  this.maxComputeNodeNum=maxComputeNodeNum;
  this.jobTrackerPort=jobTrackerPort;
  this.isComputeOnlyNode=isComputeOnlyNode;
}

Fixed version (ground truth):
public SetAutoElasticitySP(String clusterName,VcVirtualMachine vcVm,String serengetiUUID,String masterMoId,String masterUUID,Boolean enableAutoElasticity,int minComputeNodeNum,int maxComputeNodeNum,String jobTrackerPort,boolean isComputeOnlyNode){
  this.clusterName=clusterName;
  this.vcVm=vcVm;
  this.serengetiUUID=serengetiUUID;
  this.masterMoId=masterMoId;
  this.masterUUID=masterUUID;
  this.enableAutoElasticity=enableAutoElasticity;
  this.minComputeNodeNum=minComputeNodeNum;
  this.maxComputeNodeNum=maxComputeNodeNum;
  this.jobTrackerPort=jobTrackerPort;
  this.isComputeOnlyNode=isComputeOnlyNode;
}
Program: 48790
Project: 48790
Buggy source:
@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_INSTANCERANGE_COMPUTENODE_NUM,(new Integer(minComputeNodeNum)).toString() + "String_Node_Str" + (new Integer(maxComputeNodeNum)).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+ "String_Node_Str"+ maxComputeNodeNum);
  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_INSTANCERANGE_COMPUTENODE_NUM,(new Integer(minComputeNodeNum)).toString() + "String_Node_Str" + (new Integer(maxComputeNodeNum)).toString()));
    options.add(new OptionValueImpl(VHMConstants.VHM_JOBTRACKER_PORT,jobTrackerPort));
    options.add(new OptionValueImpl(VHMConstants.VHM_CLUSTER_NAME,clusterName));
  }
  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+ "String_Node_Str"+ maxComputeNodeNum);
  return null;
}
Program: 48791
Project: 48791
Buggy source:
private void redirectRequest(long taskId,HttpServletRequest request,HttpServletResponse response){
  StringBuffer url=request.getRequestURL();
  int subLength=url.length() - request.getPathInfo().length();
  url.setLength(subLength);
  url.append("String_Node_Str").append(Long.toString(taskId));
  response.setHeader("String_Node_Str",url.toString());
}

Fixed version (ground truth):
private void redirectRequest(long taskId,HttpServletRequest request,HttpServletResponse response){
  StringBuffer url=request.getRequestURL();
  String pathInfo=request.getPathInfo();
  if (!CommonUtil.validataPathInfo(pathInfo)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",pathInfo);
  }
  int subLength=url.length() - pathInfo.length();
  url.setLength(subLength);
  url.append("String_Node_Str").append(Long.toString(taskId));
  response.setHeader("String_Node_Str",url.toString());
}
Program: 48792
Project: 48792
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(chunkContext).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  getClusterEntityMgr().syncUp(clusterName,false);
  Boolean success=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success != null && !success) {
    throw ClusteringServiceException.CLUSTER_OPERATION_FAILED(clusterName);
  }
  NodeStatus expectedStatus=getFromJobExecutionContext(chunkContext,JobConstants.EXPECTED_NODE_STATUS,NodeStatus.class);
  if (expectedStatus != null) {
    logger.info("String_Node_Str" + expectedStatus);
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    JobUtils.verifyNodesStatus(nodes,expectedStatus,true);
  }
  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);
  if (clusterName == null) {
    clusterName=getJobParameters(chunkContext).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
synchronized (getClusterEntityMgr()) {
    VmEventProcessor processor=clusteringService.getEventProcessor();
    processor.trySuspend();
    getClusterEntityMgr().syncUp(clusterName,false);
  }
  Boolean success=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success != null && !success) {
    throw ClusteringServiceException.CLUSTER_OPERATION_FAILED(clusterName);
  }
  NodeStatus expectedStatus=getFromJobExecutionContext(chunkContext,JobConstants.EXPECTED_NODE_STATUS,NodeStatus.class);
  if (expectedStatus != null) {
    logger.info("String_Node_Str" + expectedStatus);
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    JobUtils.verifyNodesStatus(nodes,expectedStatus,true);
  }
  return RepeatStatus.FINISHED;
}
Program: 48793
Project: 48793
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
synchronized (getClusterEntityMgr()) {
    addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
    removeDeletedNode(clusterName,deletedNodeNames);
  }
  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);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
synchronized (getClusterEntityMgr()) {
    VmEventProcessor processor=clusteringService.getEventProcessor();
    processor.trySuspend();
    addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
    removeDeletedNode(clusterName,deletedNodeNames);
  }
  return RepeatStatus.FINISHED;
}
Program: 48794
Project: 48794
Buggy source:
private void deleteClusterNodes(String clusterName,boolean success){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  AuAssert.check(cluster != null);
  if (success) {
    releaseIp(cluster);
    getClusterEntityMgr().delete(cluster);
  }
}

Fixed version (ground truth):
private void deleteClusterNodes(String clusterName,boolean success){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  AuAssert.check(cluster != null);
  if (success) {
    releaseIp(cluster);
synchronized (getClusterEntityMgr()) {
      VmEventProcessor processor=clusteringService.getEventProcessor();
      processor.trySuspend();
      getClusterEntityMgr().delete(cluster);
    }
  }
}
Program: 48795
Project: 48795
Buggy source:
@Override public ExitStatus afterStep(StepExecution se){
  logger.info("String_Node_Str" + se.getStepName());
  ExecutionContext jec=se.getJobExecution().getExecutionContext();
  if (se.getStatus().equals(BatchStatus.COMPLETED)) {
    jec.put(se.getStepName() + "String_Node_Str",true);
    jobExecutionStatusHolder.setCurrentStepProgress(se.getJobExecution().getId(),1);
  }
 else {
    for (    Throwable t : se.getFailureExceptions()) {
      String msg=t.getMessage();
      if (msg != null && !msg.isEmpty()) {
        TrackableTasklet.putIntoJobExecutionContext(jec,JobConstants.CURRENT_ERROR_MESSAGE,msg);
        break;
      }
    }
  }
  return se.getExitStatus();
}

Fixed version (ground truth):
@Override public ExitStatus afterStep(StepExecution se){
  logger.info("String_Node_Str" + se.getStepName());
  VmEventProcessor processor=clusteringService.getEventProcessor();
  processor.tryResume();
  ExecutionContext jec=se.getJobExecution().getExecutionContext();
  if (se.getStatus().equals(BatchStatus.COMPLETED)) {
    jec.put(se.getStepName() + "String_Node_Str",true);
    jobExecutionStatusHolder.setCurrentStepProgress(se.getJobExecution().getId(),1);
  }
 else {
    for (    Throwable t : se.getFailureExceptions()) {
      String msg=t.getMessage();
      if (msg != null && !msg.isEmpty()) {
        TrackableTasklet.putIntoJobExecutionContext(jec,JobConstants.CURRENT_ERROR_MESSAGE,msg);
        break;
      }
    }
  }
  return se.getExitStatus();
}
Program: 48796
Project: 48796
Buggy source:
private boolean isValidPassword(String password){
  if (password.length() < Constants.PASSWORD_MIN_LENGTH || password.length() > Constants.PASSWORD_MAX_LENGTH) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_LENGTH_INVALID);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean isValidPassword(String password){
  if (password.length() < Constants.PASSWORD_MIN_LENGTH || password.length() > Constants.PASSWORD_MAX_LENGTH) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_LENGTH_REQUIREMENT);
    return false;
  }
  return true;
}
Program: 48797
Project: 48797
Buggy source:
private String getPassword(){
  String firstPassword=getInputedPassword(Constants.ENTER_PASSWORD);
  if (firstPassword == null) {
    return null;
  }
  String secondPassword=getInputedPassword(Constants.CONFIRM_PASSWORD);
  if (secondPassword == null) {
    return null;
  }
  if (!firstPassword.equals(secondPassword)) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_CONFIRMATION_FAILED);
    return null;
  }
  return firstPassword;
}

Fixed version (ground truth):
private String getPassword(){
  System.out.println("String_Node_Str" + Constants.PASSWORD_LENGTH_REQUIREMENT);
  String firstPassword=getInputedPassword(Constants.ENTER_PASSWORD);
  if (firstPassword == null) {
    return null;
  }
  String secondPassword=getInputedPassword(Constants.CONFIRM_PASSWORD);
  if (secondPassword == null) {
    return null;
  }
  if (!firstPassword.equals(secondPassword)) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_CONFIRMATION_FAILED);
    return null;
  }
  return firstPassword;
}
Program: 48799
Project: 48799
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
synchronized (getClusterEntityMgr()) {
    VmEventProcessor processor=clusteringService.getEventProcessor();
    processor.trySuspend();
    addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
    removeDeletedNode(clusterName,deletedNodeNames);
  }
  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);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
synchronized (getClusterEntityMgr()) {
    VmEventProcessor processor=clusteringService.getEventProcessor();
    processor.trySuspend();
    addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
    removeDeletedNode(clusterName,deletedNodeNames);
    if (chunkContext.getStepContext().getJobName().equals(JobConstants.RESUME_CLUSTER_JOB_NAME)) {
      clusterEntityMgr.syncUp(clusterName,false);
    }
  }
  return RepeatStatus.FINISHED;
}
Program: 48801
Project: 48801
Buggy source:
@Override @Transactional(readOnly=true) public List<IpBlockEntity> findAllIpBlocks(NetworkEntity entity){
  AuAssert.check(entity.getAllocType() == AllocType.IP_POOL,"String_Node_Str");
  return iIpBlockDao.merge(IpBlockEntity.dup(entity.getIpBlocks()),true,true,false);
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<IpBlockEntity> findAllIpBlocks(NetworkEntity entity){
  AuAssert.check(entity.getAllocType() == AllocType.IP_POOL,"String_Node_Str");
  return iIpBlockDao.merge(IpBlockEntity.dup(entity.getIpBlocks()),true,true,true);
}
Program: 48802
Project: 48802
Buggy source:
private boolean containInvalidCharacter(String password){
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(password);
  if (matcher.matches()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.NEW_LINE)) {
    return true;
  }
  return false;
}
Program: 48803
Project: 48803
Buggy source:
private boolean setPasswordForNode() throws Exception {
  logger.info("String_Node_Str" + nodeIP);
  String privateKeyFile=Configuration.getString(Constants.SSH_PRIVATE_KEY_CONFIG_NAME,Constants.SSH_PRIVATE_KEY_FILE_NAME);
  String sshUser=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  int sshPort=Configuration.getInt(Constants.SSH_PORT_CONFIG_NAME,Constants.DEFAULT_SSH_PORT);
  String cmd=generateSetPasswdCommand(Constants.SET_PASSWORD_SCRIPT_CONFIG_NAME,password);
  boolean setPasswordSucceed=false;
  for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
    SSHUtil sshUtil=new SSHUtil();
    setPasswordSucceed=sshUtil.execCmd(sshUser,privateKeyFile,nodeIP,sshPort,cmd);
    if (setPasswordSucceed) {
      break;
    }
 else {
      logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
      try {
        Thread.sleep(2000);
      }
 catch (      InterruptedException e) {
        logger.info("String_Node_Str");
      }
    }
  }
  if (setPasswordSucceed) {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return true;
  }
 else {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    throw new Exception(Constants.CHECK_WHETHER_SSH_ACCESS_AVAILABLE);
  }
}

Fixed version (ground truth):
private boolean setPasswordForNode() throws Exception {
  logger.info("String_Node_Str" + nodeIP);
  String privateKeyFile=Configuration.getString(Constants.SSH_PRIVATE_KEY_CONFIG_NAME,Constants.SSH_PRIVATE_KEY_FILE_NAME);
  String sshUser=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  int sshPort=Configuration.getInt(Constants.SSH_PORT_CONFIG_NAME,Constants.DEFAULT_SSH_PORT);
  String cmd=generateSetPasswdCommand(Constants.SET_PASSWORD_SCRIPT_CONFIG_NAME,password);
  InputStream in=null;
  try {
    in=parseInputStream(new String(password + Constants.NEW_LINE + password+ Constants.NEW_LINE));
    boolean setPasswordSucceed=false;
    for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
      SSHUtil sshUtil=new SSHUtil();
      setPasswordSucceed=sshUtil.execCmd(sshUser,privateKeyFile,nodeIP,sshPort,cmd,in,null);
      if (setPasswordSucceed) {
        break;
      }
 else {
        logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
        try {
          Thread.sleep(2000);
        }
 catch (        InterruptedException e) {
          logger.info("String_Node_Str");
        }
      }
    }
    if (setPasswordSucceed) {
      logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
      return true;
    }
 else {
      logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
      throw new Exception(Constants.CHECK_WHETHER_SSH_ACCESS_AVAILABLE);
    }
  }
  finally {
    if (in != null) {
      in.close();
    }
  }
}
Program: 48804
Project: 48804
Buggy source:
private String generateSetPasswdCommand(String setPasswdScriptConfig,String password){
  String scriptFileName=Configuration.getString(setPasswdScriptConfig,Constants.DEFAULT_SET_PASSWORD_SCRIPT);
  String[] commands=new String[8];
  String tmpScript="String_Node_Str";
  commands[0]="String_Node_Str" + tmpScript;
  commands[1]="String_Node_Str" + scriptFileName + "String_Node_Str"+ "String_Node_Str"+ tmpScript;
  commands[2]="String_Node_Str" + password + "String_Node_Str"+ tmpScript;
  commands[3]=commands[2];
  commands[4]="String_Node_Str" + tmpScript;
  commands[5]="String_Node_Str" + tmpScript;
  commands[6]="String_Node_Str" + tmpScript;
  commands[7]="String_Node_Str" + tmpScript;
  StringBuilder sb=new StringBuilder().append(commands[0]).append("String_Node_Str").append(commands[1]).append("String_Node_Str").append(commands[2]).append("String_Node_Str").append(commands[3]).append("String_Node_Str").append(commands[4]).append("String_Node_Str").append(commands[5]).append("String_Node_Str").append(commands[6]).append("String_Node_Str").append(commands[7]);
  return sb.toString();
}

Fixed version (ground truth):
private String generateSetPasswdCommand(String setPasswdScriptConfig,String password){
  String scriptFileName=Configuration.getString(setPasswdScriptConfig,Constants.DEFAULT_SET_PASSWORD_SCRIPT);
  return "String_Node_Str" + scriptFileName + "String_Node_Str";
}
Program: 48808
Project: 48808
Buggy source:
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password){
  logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName);
  String privateKeyFile=Configuration.getString(Constants.SSH_PRIVATE_KEY_CONFIG_NAME,Constants.SSH_PRIVATE_KEY_FILE_NAME);
  String sshUser=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  int sshPort=Configuration.getInt(Constants.SSH_PORT_CONFIG_NAME,Constants.DEFAULT_SSH_PORT);
  String[] cmds=generateSetPasswdCommand(Constants.SET_PASSWORD_SCRIPT_CONFIG_NAME,password);
  boolean succeed=false;
  for (  String cmd : cmds) {
    succeed=SSHUtil.execCmd(sshUser,privateKeyFile,nodeIP,sshPort,cmd);
    if (succeed) {
      logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
    }
 else {
      logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
    }
  }
  if (succeed) {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return true;
  }
 else {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password){
  logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName);
  String privateKeyFile=Configuration.getString(Constants.SSH_PRIVATE_KEY_CONFIG_NAME,Constants.SSH_PRIVATE_KEY_FILE_NAME);
  String sshUser=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  int sshPort=Configuration.getInt(Constants.SSH_PORT_CONFIG_NAME,Constants.DEFAULT_SSH_PORT);
  String[] cmds=generateSetPasswdCommand(Constants.SET_PASSWORD_SCRIPT_CONFIG_NAME,password);
  boolean setPasswordSucceed=false;
  for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
    boolean commandSucceed=false;
    for (    String cmd : cmds) {
      commandSucceed=SSHUtil.execCmd(sshUser,privateKeyFile,nodeIP,sshPort,cmd);
      if (commandSucceed) {
        logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
      }
 else {
        logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
        break;
      }
    }
    if (commandSucceed) {
      setPasswordSucceed=true;
      break;
    }
 else {
      logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
      try {
        Thread.sleep(2000);
      }
 catch (      InterruptedException e) {
        logger.info("String_Node_Str");
      }
    }
  }
  if (setPasswordSucceed) {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return true;
  }
 else {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return false;
  }
}
Program: 48809
Project: 48809
Buggy source:
public ArrayList<String> setPasswordForNodes(String clusterName,ArrayList<String> ipsOfNodes,String password){
  AuAssert.check(!ipsOfNodes.isEmpty());
  logger.info("String_Node_Str" + clusterName);
  logger.info("String_Node_Str" + ipsOfNodes.toString());
  ArrayList<String> failedIPs=null;
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  for (  String nodeIP : ipsOfNodes) {
    SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(clusterName,nodeIP,password);
    storeProcedures.add(setVMPasswordSP);
  }
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    for (int i=0; i < storeProceduresArray.length; i++) {
      if (!result[i].finished || result[i].throwable != null) {
        SetVMPasswordSP sp=(SetVMPasswordSP)storeProceduresArray[i];
        String failedNodeIP=sp.getNodeIP();
        if (failedIPs == null) {
          failedIPs=new ArrayList<String>();
        }
        failedIPs.add(failedNodeIP);
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName);
    throw BddException.INTERNAL(e,"String_Node_Str" + clusterName);
  }
  return failedIPs;
}

Fixed version (ground truth):
public ArrayList<String> setPasswordForNodes(String clusterName,ArrayList<String> ipsOfNodes,String password){
  AuAssert.check(!ipsOfNodes.isEmpty());
  logger.info("String_Node_Str" + clusterName);
  logger.info("String_Node_Str" + ipsOfNodes.toString());
  ArrayList<String> failedIPs=null;
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  for (  String nodeIP : ipsOfNodes) {
    SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
    storeProcedures.add(setVMPasswordSP);
  }
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    for (int i=0; i < storeProceduresArray.length; i++) {
      if (!result[i].finished || result[i].throwable != null) {
        SetVMPasswordSP sp=(SetVMPasswordSP)storeProceduresArray[i];
        String failedNodeIP=sp.getNodeIP();
        if (failedIPs == null) {
          failedIPs=new ArrayList<String>();
        }
        failedIPs.add(failedNodeIP);
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName);
    throw BddException.INTERNAL(e,"String_Node_Str" + clusterName);
  }
  return failedIPs;
}
Program: 48810
Project: 48810
Buggy source:
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password) throws Exception {
  logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName);
  String privateKeyFile=Configuration.getString(Constants.SSH_PRIVATE_KEY_CONFIG_NAME,Constants.SSH_PRIVATE_KEY_FILE_NAME);
  String sshUser=Configuration.getString(Constants.SSH_USER_CONFIG_NAME,Constants.DEFAULT_SSH_USER_NAME);
  int sshPort=Configuration.getInt(Constants.SSH_PORT_CONFIG_NAME,Constants.DEFAULT_SSH_PORT);
  String[] cmds=generateSetPasswdCommand(Constants.SET_PASSWORD_SCRIPT_CONFIG_NAME,password);
  boolean setPasswordSucceed=false;
  for (int i=0; i < Constants.SET_PASSWORD_MAX_RETRY_TIMES; i++) {
    boolean commandSucceed=false;
    for (    String cmd : cmds) {
      commandSucceed=SSHUtil.execCmd(sshUser,privateKeyFile,nodeIP,sshPort,cmd);
      if (commandSucceed) {
        logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
      }
 else {
        logger.info("String_Node_Str" + "String_Node_Str" + nodeIP + "String_Node_Str");
        break;
      }
    }
    if (commandSucceed) {
      setPasswordSucceed=true;
      break;
    }
 else {
      logger.info("String_Node_Str" + nodeIP + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
      try {
        Thread.sleep(2000);
      }
 catch (      InterruptedException e) {
        logger.info("String_Node_Str");
      }
    }
  }
  if (setPasswordSucceed) {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    return true;
  }
 else {
    logger.info("String_Node_Str" + nodeIP + "String_Node_Str");
    throw new Exception(Constants.CHECK_WHETHER_SSH_ACCESS_AVAILABLE);
  }
}

Fixed version (ground truth):
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password) throws Exception {
  AuAssert.check(clusterName != null && nodeIP != null && password != null);
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
  storeProcedures.add(setVMPasswordSP);
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    if (result[0].finished && result[0].throwable == null) {
      return true;
    }
    return false;
  }
 catch (  Exception e) {
    throw BddException.INTERNAL(e,"String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName);
  }
}
Program: 48811
Project: 48811
Buggy source:
public SetVMPasswordSP(String clusterName,String nodeIP,String password){
  this.clusterName=clusterName;
  this.nodeIP=nodeIP;
  this.password=password;
}

Fixed version (ground truth):
public SetVMPasswordSP(String nodeIP,String password){
  this.nodeIP=nodeIP;
  this.password=password;
}
Program: 48812
Project: 48812
Buggy source:
@Override public Void call() throws Exception {
  setPasswordService.setPasswordForNode(clusterName,nodeIP,password);
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  setPasswordForNode();
  return null;
}
Program: 48814
Project: 48814
Buggy source:
private static void connect(String user,String privateKeyFile,String hostIP,int sshPort){
  jsch=new JSch();
  try {
    session=jsch.getSession(user,hostIP,sshPort);
    jsch.addIdentity(privateKeyFile);
    java.util.Properties config=new java.util.Properties();
    config.put("String_Node_Str","String_Node_Str");
    session.setConfig(config);
    session.setTimeout(Constants.SSH_SESSION_TIMEOUT);
    session.connect();
    logger.debug("String_Node_Str");
  }
 catch (  JSchException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void connect(String user,String privateKeyFile,String hostIP,int sshPort){
  jsch=new JSch();
  try {
    session=jsch.getSession(user,hostIP,sshPort);
    jsch.addIdentity(privateKeyFile);
    java.util.Properties config=new java.util.Properties();
    config.put("String_Node_Str","String_Node_Str");
    session.setConfig(config);
    session.setTimeout(Constants.SSH_SESSION_TIMEOUT);
    session.connect();
    logger.debug("String_Node_Str");
  }
 catch (  JSchException e) {
    e.printStackTrace();
  }
}
Program: 48815
Project: 48815
Buggy source:
private void showFailedMsg(String name,List<String> failedMsgList){
  StringBuilder failedMsg=new StringBuilder();
  failedMsg.append(Constants.INVALID_VALUE);
  if (failedMsgList.size() > 1) {
    failedMsg.append("String_Node_Str");
  }
  failedMsg.append("String_Node_Str");
  StringBuilder tmpMsg=new StringBuilder();
  for (  String msg : failedMsgList) {
    tmpMsg.append(msg);
  }
  failedMsg.append(tmpMsg);
  CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,failedMsg.toString());
}

Fixed version (ground truth):
private void showFailedMsg(String name,List<String> failedMsgList){
  StringBuilder failedMsg=new StringBuilder();
  failedMsg.append(Constants.INVALID_VALUE);
  if (failedMsgList.size() > 1) {
    failedMsg.append("String_Node_Str");
  }
  failedMsg.append("String_Node_Str");
  StringBuilder tmpMsg=new StringBuilder();
  for (  String msg : failedMsgList) {
    tmpMsg.append(msg).append("String_Node_Str");
  }
  failedMsg.append(tmpMsg);
  CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,failedMsg.toString());
}
Program: 48817
Project: 48817
Buggy source:
private void makeVmMemoryDivisibleBy4(NodeGroupCreate nodeGroup,List<String> warningMsgList){
  int memoryNum=nodeGroup.getMemCapacityMB();
  if (memoryNum > 0) {
    long converted=CommonUtil.makeVmMemoryDivisibleBy4(memoryNum);
    if (converted < memoryNum) {
      nodeGroup.setMemCapacityMB((int)converted);
      warningMsgList.add(Constants.CONVERTED_MEMORY_DIVISIBLE_BY_4 + "String_Node_Str" + nodeGroup.getName()+ "String_Node_Str"+ converted+ "String_Node_Str"+ memoryNum+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void makeVmMemoryDivisibleBy4(NodeGroupCreate nodeGroup,List<String> warningMsgList){
  int memoryCap=nodeGroup.getMemCapacityMB();
  if (memoryCap > 0) {
    long converted=CommonUtil.makeVmMemoryDivisibleBy4(memoryCap);
    if (converted < memoryCap) {
      nodeGroup.setMemCapacityMB((int)converted);
      warningMsgList.add(Constants.CONVERTED_MEMORY_DIVISIBLE_BY_4 + "String_Node_Str" + nodeGroup.getName()+ "String_Node_Str"+ converted+ "String_Node_Str"+ memoryCap+ "String_Node_Str");
    }
  }
}
Program: 48818
Project: 48818
Buggy source:
public void setMemCapacityMB(int memCapacityMB){
  this.memCapacityMB=memCapacityMB;
}

Fixed version (ground truth):
public void setMemCapacityMB(Integer memCapacityMB){
  this.memCapacityMB=memCapacityMB;
}
Program: 48819
Project: 48819
Buggy source:
public int getCpuNum(){
  return cpuNum;
}

Fixed version (ground truth):
public Integer getCpuNum(){
  return cpuNum;
}
Program: 48820
Project: 48820
Buggy source:
public void setCpuNum(int cpuNum){
  this.cpuNum=cpuNum;
}

Fixed version (ground truth):
public void setCpuNum(Integer cpuNum){
  this.cpuNum=cpuNum;
}
Program: 48821
Project: 48821
Buggy source:
public int getMemCapacityMB(){
  return memCapacityMB;
}

Fixed version (ground truth):
public Integer getMemCapacityMB(){
  return memCapacityMB;
}
Program: 48824
Project: 48824
Buggy source:
private CreateVmPrePowerOn getPrePowerOnFunc(BaseNode vNode){
  boolean persistentDiskMode=false;
  String haFlag=vNode.getNodeGroup().getHaFlag();
  boolean ha=false;
  boolean ft=false;
  if (haFlag != null && Constants.HA_FLAG_ON.equals(haFlag.toLowerCase())) {
    ha=true;
  }
  if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
    ha=true;
    ft=true;
    if (vNode.getNodeGroup().getCpuNum() > 1) {
      throw ClusteringServiceException.CPU_NUMBER_MORE_THAN_ONE(vNode.getVmName());
    }
    logger.debug("String_Node_Str" + vNode.getVmName());
    logger.debug("String_Node_Str" + vNode.getVmName());
    persistentDiskMode=true;
  }
  List<String> roles=vNode.getNodeGroup().getRoles();
  if (roles != null && HadoopRole.hasMgmtRole(roles)) {
    logger.debug(vNode.getVmName() + "String_Node_Str");
    logger.debug("String_Node_Str" + vNode.getVmName());
    persistentDiskMode=true;
  }
  if (persistentDiskMode) {
    setPersistentDiskMode(vNode);
  }
  ClusterEntity clusterEntity=getClusterEntityMgr().findByName(vNode.getClusterName());
  CreateVmPrePowerOn prePowerOn=new CreateVmPrePowerOn(ha,ft,clusterEntity.getIoShares());
  return prePowerOn;
}

Fixed version (ground truth):
private CreateVmPrePowerOn getPrePowerOnFunc(BaseNode vNode){
  boolean persistentDiskMode=false;
  String haFlag=vNode.getNodeGroup().getHaFlag();
  boolean ha=false;
  boolean ft=false;
  if (haFlag != null && Constants.HA_FLAG_ON.equals(haFlag.toLowerCase())) {
    ha=true;
  }
  if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
    ha=true;
    ft=true;
    Integer cpuNum=vNode.getNodeGroup().getCpuNum();
    cpuNum=(cpuNum == null) ? 0 : cpuNum;
    if (cpuNum > 1) {
      throw ClusteringServiceException.CPU_NUMBER_MORE_THAN_ONE(vNode.getVmName());
    }
    logger.debug("String_Node_Str" + vNode.getVmName());
    logger.debug("String_Node_Str" + vNode.getVmName());
    persistentDiskMode=true;
  }
  List<String> roles=vNode.getNodeGroup().getRoles();
  if (roles != null && HadoopRole.hasMgmtRole(roles)) {
    logger.debug(vNode.getVmName() + "String_Node_Str");
    logger.debug("String_Node_Str" + vNode.getVmName());
    persistentDiskMode=true;
  }
  if (persistentDiskMode) {
    setPersistentDiskMode(vNode);
  }
  ClusterEntity clusterEntity=getClusterEntityMgr().findByName(vNode.getClusterName());
  CreateVmPrePowerOn prePowerOn=new CreateVmPrePowerOn(ha,ft,clusterEntity.getIoShares());
  return prePowerOn;
}
Program: 48828
Project: 48828
Buggy source:
public int getMem(){
  return nodeGroup.getMemCapacityMB();
}

Fixed version (ground truth):
public int getMem(){
  return nodeGroup.getMemCapacityMB() == null ? 0 : nodeGroup.getMemCapacityMB();
}
Program: 48829
Project: 48829
Buggy source:
public int getCpu(){
  return nodeGroup.getCpuNum();
}

Fixed version (ground truth):
public int getCpu(){
  return nodeGroup.getCpuNum() == null ? 0 : nodeGroup.getCpuNum();
}
Program: 48833
Project: 48833
Buggy source:
private void refreshNodeStatus(NodeEntity node,boolean inSession){
  String mobId=node.getMoId();
  if (mobId == null) {
    setNotExist(node);
    return;
  }
  VcVirtualMachine vcVm=VcCache.getIgnoreMissing(mobId);
  if (vcVm == null) {
    setNotExist(node);
    return;
  }
  if (!vcVm.isPoweredOn()) {
    node.setStatus(NodeStatus.POWERED_OFF);
    node.resetIps();
  }
 else {
    node.setStatus(NodeStatus.POWERED_ON);
  }
  if (vcVm.isPoweredOn() && node.isPowerStatusChanged()) {
    for (    String portGroup : node.fetchAllPortGroups()) {
      String ip=VcVmUtil.getIpAddressOfPortGroup(vcVm,portGroup,inSession);
      node.updateIpAddressOfPortGroup(portGroup,ip);
    }
    if (node.ipsReady()) {
      node.setStatus(NodeStatus.VM_READY);
      if (node.getAction() != null && (node.getAction().equals(Constants.NODE_ACTION_WAITING_IP) || node.getAction().equals(Constants.NODE_ACTION_RECONFIGURE))) {
        node.setAction(null);
      }
    }
    String guestHostName=VcVmUtil.getGuestHostName(vcVm,inSession);
    if (guestHostName != null) {
      node.setGuestHostName(guestHostName);
    }
  }
  node.setHostName(vcVm.getHost().getName());
  update(node);
}

Fixed version (ground truth):
private void refreshNodeStatus(NodeEntity node,boolean inSession){
  String mobId=node.getMoId();
  if (mobId == null) {
    setNotExist(node);
    return;
  }
  VcVirtualMachine vcVm=VcCache.getIgnoreMissing(mobId);
  if (vcVm == null) {
    setNotExist(node);
    return;
  }
  if (!vcVm.isPoweredOn()) {
    node.setStatus(NodeStatus.POWERED_OFF);
    node.resetIps();
  }
 else {
    node.setStatus(NodeStatus.POWERED_ON);
  }
  if (vcVm.isPoweredOn()) {
    for (    String portGroup : node.fetchAllPortGroups()) {
      String ip=VcVmUtil.getIpAddressOfPortGroup(vcVm,portGroup,inSession);
      node.updateIpAddressOfPortGroup(portGroup,ip);
    }
    if (node.ipsReady()) {
      node.setStatus(NodeStatus.VM_READY);
      if (node.getAction() != null && (node.getAction().equals(Constants.NODE_ACTION_WAITING_IP) || node.getAction().equals(Constants.NODE_ACTION_RECONFIGURE))) {
        node.setAction(null);
      }
    }
    String guestHostName=VcVmUtil.getGuestHostName(vcVm,inSession);
    if (guestHostName != null) {
      node.setGuestHostName(guestHostName);
    }
  }
  node.setHostName(vcVm.getHost().getName());
  update(node);
}
Program: 48836
Project: 48836
Buggy source:
public void setStatus(NodeStatus status,boolean validation){
  if (validation) {
    setStatus(status);
  }
 else {
    this.status=status;
  }
}

Fixed version (ground truth):
public void setStatus(NodeStatus status,boolean validation){
  if (validation) {
    setStatus(status);
  }
 else {
    logger.debug("String_Node_Str" + getVmName() + "String_Node_Str"+ status+ "String_Node_Str");
    this.status=status;
  }
}
Program: 48837
Project: 48837
Buggy source:
/** 
 * the latest_task_id attribute of a cluster entity records the latest job id the cluster executes
 * @return
 */
public List<TaskRead> getLatestTaskForExistedClusters(){
  List<Long> taskIds=clusterEntityMgr.getLatestTaskIds();
  List<TaskRead> taskReads=new ArrayList<TaskRead>(taskIds.size());
  for (  Long id : taskIds) {
    if (id == null)     continue;
    TaskRead task=getJobExecutionStatus(id);
    task.setType(Type.INNER);
    taskReads.add(task);
  }
  return taskReads;
}

Fixed version (ground truth):
/** 
 * the latest_task_id attribute of a cluster entity records the latest job id the cluster executes
 * @return
 */
public List<TaskRead> getLatestTaskForExistedClusters(){
  List<Long> taskIds=clusterEntityMgr.getLatestTaskIds();
  List<TaskRead> taskReads=new ArrayList<TaskRead>(taskIds.size());
  for (  Long id : taskIds) {
    if (id == null)     continue;
    TaskRead task=getJobExecutionStatus(id);
    task.setType(Type.INNER);
    if (task.getStatus() == TaskRead.Status.COMPLETED) {
      task.setProgress(1.0);
    }
    taskReads.add(task);
  }
  return taskReads;
}
Program: 48838
Project: 48838
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public TaskRead getTaskById(@PathVariable long taskId) throws Exception {
  TaskRead task=jobManager.getJobExecutionStatus(taskId);
  if (task.getType() == null) {
    task.setType(Type.INNER);
  }
  return task;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public TaskRead getTaskById(@PathVariable long taskId) throws Exception {
  TaskRead task=jobManager.getJobExecutionStatus(taskId);
  if (task.getStatus() == TaskRead.Status.COMPLETED) {
    task.setProgress(1.0);
  }
  if (task.getType() == null) {
    task.setType(Type.INNER);
  }
  return task;
}