nus-yam/ex-repair huggingface dataset:
Program: 48736
Project: 48736
Buggy source:
@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();
}

Fixed version (ground truth):
@Override public ExitStatus afterStep(StepExecution se){
  logger.info("String_Node_Str" + se.getStepName());
  if (clusteringService != null) {
    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: 48737
Project: 48737
Buggy source:
private String switchMobId(String moId,VcVirtualMachine vm) throws Exception {
  if (vm.getConfig().getFtInfo() != null) {
    vm.update();
    if (vm.getConfig().getFtInfo().getRole() != 1) {
      FaultToleranceSecondaryConfigInfo ftInfo=(FaultToleranceSecondaryConfigInfo)vm.getConfig().getFtInfo();
      moId=MoUtil.morefToString(ftInfo.getPrimaryVM());
      logger.info("String_Node_Str" + moId);
    }
  }
  return moId;
}

Fixed version (ground truth):
private String switchMobId(String moId,VcVirtualMachine vm) throws Exception {
  if (vm.getConfig() != null && vm.getConfig().getFtInfo() != null) {
    vm.update();
    if (vm.getConfig().getFtInfo().getRole() != 1) {
      FaultToleranceSecondaryConfigInfo ftInfo=(FaultToleranceSecondaryConfigInfo)vm.getConfig().getFtInfo();
      moId=MoUtil.morefToString(ftInfo.getPrimaryVM());
      logger.info("String_Node_Str" + moId);
    }
  }
  return moId;
}
Program: 48739
Project: 48739
Buggy source:
private void addDatastoreEntity(final DatastoreType type,final List<String> datastores,final String name,final boolean regex){
  if (dsDao.nameExisted(name)) {
    throw BddException.ALREADY_EXISTS("String_Node_Str",name);
  }
  resService.refreshDatastore();
  for (  String ds : datastores) {
    String dsPattern=ds;
    if (!regex) {
      dsPattern=CommonUtil.getDatastoreJavaPattern(ds);
    }
    if (!resService.isDatastoreExistInVC(dsPattern)) {
      throw VcProviderException.DATASTORE_NOT_FOUND(ds);
    }
    VcDatastoreEntity entity=new VcDatastoreEntity();
    entity.setType(type);
    entity.setName(name);
    entity.setVcDatastore(ds);
    entity.setRegex(regex);
    dsDao.insert(entity);
    logger.info("String_Node_Str" + ds);
  }
}

Fixed version (ground truth):
private void addDatastoreEntity(final DatastoreType type,final List<String> datastores,final String name,final boolean regex){
  if (dsDao.nameExisted(name)) {
    throw BddException.ALREADY_EXISTS("String_Node_Str",name);
  }
  resService.refreshDatastore();
  for (  String ds : datastores) {
    String dsPattern=ds;
    if (!regex) {
      dsPattern=CommonUtil.getDatastoreJavaPattern(ds);
    }
    if (!resService.isDatastoreExistInVC(dsPattern)) {
      throw VcProviderException.DATASTORE_NOT_FOUND(ds);
    }
    VcDatastoreEntity entity=new VcDatastoreEntity();
    entity.setType(type);
    entity.setName(name);
    entity.setVcDatastore(ds);
    entity.setRegex(regex);
    dsDao.insert(entity);
    logger.info("String_Node_Str" + type + "String_Node_Str"+ ds);
  }
}
Program: 48740
Project: 48740
Buggy source:
/** 
 * Get the datastore path for a file under the VM directory on a different datastore. The file would be either at the root of the datastore name-prefixed with the VM name or in a directory with same name as the VM directory.
 * @param vm virtual machine object
 * @param ds datastore (null means the default VM datastore)
 * @param name file name
 * @return
 */
public static String getDsPath(VcVirtualMachine vm,VcDatastore ds,String name){
  if (ds == null) {
    return getDsPath(vm,name);
  }
 else {
    try {
      return String.format("String_Node_Str",ds.getURLName(),dropDsFromPath(vm.getPathName()).trim(),name);
    }
 catch (    Exception ex) {
      throw BaseVMException.INVALID_FILE_PATH(ex,vm.getPathName());
    }
  }
}

Fixed version (ground truth):
/** 
 * Get the datastore path for a file under the VM directory on a different datastore. The file would be either at the root of the datastore name-prefixed with the VM name or in a directory with same name as the VM directory.
 * @param vm virtual machine object
 * @param ds datastore (null means the default VM datastore)
 * @param name file name
 * @return
 */
public static String getDsPath(VcVirtualMachine vm,VcDatastore ds,String name){
  if (ds == null) {
    return getDsPath(vm,name);
  }
 else {
    try {
      return String.format("String_Node_Str",ds.getName());
    }
 catch (    Exception ex) {
      throw BaseVMException.INVALID_FILE_PATH(ex,vm.getPathName());
    }
  }
}
Program: 48741
Project: 48741
Buggy source:
public static void setString(String key,String value){
  config.setProperty(key,value);
  if (vcCfg.containsKey(key)) {
    vcCfg.setProperty(key,value);
  }
 else   if (serengetiCfg.containsKey(key)) {
    serengetiCfg.setProperty(key,value);
  }
}

Fixed version (ground truth):
public static void setString(String key,String value){
  config.setProperty(key,value);
  if (vcCfg.containsKey(key)) {
    vcCfg.setProperty(key,value);
  }
 else {
    serengetiCfg.setProperty(key,value);
  }
}
Program: 48742
Project: 48742
Buggy source:
/** 
 * Set the boolean value of a given key
 * @param key
 * @param value
 */
public static void setBoolean(String key,Boolean value){
  config.setProperty(key,value);
  if (vcCfg.containsKey(key)) {
    vcCfg.setProperty(key,value);
  }
 else   if (serengetiCfg.containsKey(key)) {
    serengetiCfg.setProperty(key,value);
  }
}

Fixed version (ground truth):
/** 
 * Set the boolean value of a given key
 * @param key
 * @param value
 */
public static void setBoolean(String key,Boolean value){
  config.setProperty(key,value);
  if (vcCfg.containsKey(key)) {
    vcCfg.setProperty(key,value);
  }
 else {
    serengetiCfg.setProperty(key,value);
  }
}
Program: 48744
Project: 48744
Buggy source:
private static void initVcConfig(){
  vcHost=Configuration.getString("String_Node_Str");
  vcPort=Configuration.getInt("String_Node_Str",443);
  evsURL=Configuration.getString("String_Node_Str");
  evsToken=Configuration.getString("String_Node_Str");
  vcThumbprint=Configuration.getString("String_Node_Str",null);
  extKey="String_Node_Str" + Configuration.getCmsInstanceId();
  userName=Configuration.getString("String_Node_Str",null);
  password=Configuration.getString("String_Node_Str",null);
  locale=Configuration.getString("String_Node_Str","String_Node_Str");
  HttpsConnectionUtil.init(vcThumbprint);
  configured=true;
}

Fixed version (ground truth):
private static void initVcConfig(){
  vcHost=Configuration.getString("String_Node_Str");
  vcPort=Configuration.getInt("String_Node_Str",443);
  evsURL=Configuration.getString("String_Node_Str");
  evsToken=Configuration.getString("String_Node_Str");
  vcThumbprint=Configuration.getString("String_Node_Str",null);
  extKey="String_Node_Str" + Configuration.getCmsInstanceId();
  vcExtensionRegistered=Configuration.getBoolean(SERENGETI_EXTENSION_REGISTERED,false);
  userName=Configuration.getString("String_Node_Str",null);
  password=Configuration.getString("String_Node_Str",null);
  locale=Configuration.getString("String_Node_Str","String_Node_Str");
  HttpsConnectionUtil.init(vcThumbprint);
  configured=true;
}
Program: 48746
Project: 48746
Buggy source:
public void setRegex(Boolean regex){
  if (regex != null && regex) {
    this.regex="String_Node_Str";
  }
 else {
    this.regex="String_Node_Str";
  }
}

Fixed version (ground truth):
public void setRegex(String regex){
  this.regex=regex;
}
Program: 48747
Project: 48747
Buggy source:
@Override @Transactional(readOnly=true) public List<DatastoreRead> getAllDatastoreReads(){
  logger.debug("String_Node_Str");
  List<VcDatastoreEntity> entities=dsDao.findAllSortByName();
  List<DatastoreRead> result=new ArrayList<DatastoreRead>();
  if (entities.isEmpty()) {
    return result;
  }
  DatastoreRead read=new DatastoreRead();
  read.setName(entities.get(0).getName());
  read.setType(entities.get(0).getType());
  read.setRegex(entities.get(0).getRegex());
  read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
  result.add(read);
  for (  VcDatastoreEntity entity : entities) {
    if (!entity.getName().equals(read.getName())) {
      read=new DatastoreRead();
      read.setName(entity.getName());
      read.setType(entity.getType());
      read.setRegex(entity.getRegex());
      read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
      result.add(read);
    }
    DatastoreReadDetail detail=new DatastoreReadDetail();
    detail.setVcDatastoreName(entity.getVcDatastore());
    read.getDatastoreReadDetails().add(detail);
  }
  logger.debug("String_Node_Str" + result);
  return result;
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<DatastoreRead> getAllDatastoreReads(){
  logger.debug("String_Node_Str");
  List<VcDatastoreEntity> entities=dsDao.findAllSortByName();
  List<DatastoreRead> result=new ArrayList<DatastoreRead>();
  if (entities.isEmpty()) {
    return result;
  }
  DatastoreRead read=new DatastoreRead();
  read.setName(entities.get(0).getName());
  read.setType(entities.get(0).getType());
  read.setRegexByBoolean(entities.get(0).getRegex());
  read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
  result.add(read);
  for (  VcDatastoreEntity entity : entities) {
    if (!entity.getName().equals(read.getName())) {
      read=new DatastoreRead();
      read.setName(entity.getName());
      read.setType(entity.getType());
      read.setRegexByBoolean(entity.getRegex());
      read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
      result.add(read);
    }
    DatastoreReadDetail detail=new DatastoreReadDetail();
    detail.setVcDatastoreName(entity.getVcDatastore());
    read.getDatastoreReadDetails().add(detail);
  }
  logger.debug("String_Node_Str" + result);
  return result;
}
Program: 48748
Project: 48748
Buggy source:
@Override @Transactional(readOnly=true) public DatastoreRead getDatastoreRead(String name){
  logger.debug("String_Node_Str" + name);
  List<VcDatastoreEntity> entities=dsDao.findByName(name);
  if (entities.isEmpty()) {
    return null;
  }
  DatastoreRead read=new DatastoreRead();
  read.setName(name);
  read.setType(entities.get(0).getType());
  read.setRegex(entities.get(0).getRegex());
  read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
  for (  VcDatastoreEntity entity : entities) {
    DatastoreReadDetail detail=new DatastoreReadDetail();
    detail.setVcDatastoreName(entity.getVcDatastore());
    read.getDatastoreReadDetails().add(detail);
  }
  logger.debug("String_Node_Str" + read);
  return read;
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public DatastoreRead getDatastoreRead(String name){
  logger.debug("String_Node_Str" + name);
  List<VcDatastoreEntity> entities=dsDao.findByName(name);
  if (entities.isEmpty()) {
    return null;
  }
  DatastoreRead read=new DatastoreRead();
  read.setName(name);
  read.setType(entities.get(0).getType());
  read.setRegexByBoolean(entities.get(0).getRegex());
  read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
  for (  VcDatastoreEntity entity : entities) {
    DatastoreReadDetail detail=new DatastoreReadDetail();
    detail.setVcDatastoreName(entity.getVcDatastore());
    read.getDatastoreReadDetails().add(detail);
  }
  logger.debug("String_Node_Str" + read);
  return read;
}
Program: 48749
Project: 48749
Buggy source:
/** 
 * Blocking wait for task completion. Wait on task's monitor until a notification of a task completion by VcEventListener thread.
 * @return the VC object as a result of this task.
 * @exception on failure
 */
public synchronized VcObject waitForCompletion() throws Exception {
  Task task=getManagedObject();
  StatsType oldSrc=Profiler.pushInc(StatsType.VC_TASK_WAIT,getType());
  long lastWaitStartedNanos;
  long waitFinishedNanos=System.nanoTime();
  state=task.getInfo().getState();
  totalWaitTimeNanos=0;
  while (state != State.success) {
    boolean normalWaitCompletion=false;
switch (state) {
case success:
      break;
case error:
    completionTimeNanos=waitFinishedNanos;
  logTaskError(task);
assistBadTaskCompletion();
throw task.getInfo().getError();
case queued:
case running:
lastWaitStartedNanos=System.nanoTime();
try {
isWaiting=true;
wait(TimeUnit.NANOSECONDS.toMillis(getWaitIntervalNanos()));
normalWaitCompletion=true;
}
 catch (InterruptedException e) {
}
 finally {
isWaiting=false;
waitFinishedNanos=System.nanoTime();
lastWaitTimeNanos=waitFinishedNanos - lastWaitStartedNanos;
totalWaitTimeNanos+=lastWaitTimeNanos;
}
break;
default :
AuAssert.check(false);
}
state=task.getInfo().getState();
verifyWaitCompletion(normalWaitCompletion);
}
AuAssert.check(taskCompleted());
logger.debug("String_Node_Str" + type + "String_Node_Str");
completionTimeNanos=waitFinishedNanos;
assistBadTaskCompletion();
if (!(type.getTargetClass() == Void.class)) {
taskResult=task.getInfo().getResult();
if (taskResult instanceof ManagedObjectReference) {
if (type == TaskType.Snapshot) {
VcVirtualMachineImpl vm=(VcVirtualMachineImpl)parent;
vm.update();
result=vm.getSnapshot((ManagedObjectReference)taskResult);
}
 else {
result=VcCache.load((ManagedObjectReference)taskResult);
if (type == TaskType.CloneVm || type == TaskType.CreateVm) {
VcVirtualMachineImpl vm=(VcVirtualMachineImpl)result;
vm.refreshRP();
}
}
AuAssert.check(type.getTargetClass().isInstance(result));
}
 else if (taskResult != null) {
AuAssert.check(type.getTargetClass().isInstance(taskResult));
}
}
invokeCallbacks(true);
Profiler.pop(oldSrc);
return result;
}

Fixed version (ground truth):
/** 
 * Blocking wait for task completion. Wait on task's monitor until a notification of a task completion by VcEventListener thread.
 * @return the VC object as a result of this task.
 * @exception on failure
 */
public synchronized VcObject waitForCompletion() throws Exception {
  totalWaitTimeNanos=0;
  Exception catchedException=null;
  for (int i=0; i < maxRetryNum; i++) {
    try {
      return waitForCompletionIntenal();
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        wait(TimeUnit.NANOSECONDS.toMillis(getWaitIntervalNanos()));
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48750
Project: 48750
Buggy source:
/** 
 * A way to call "VC pseudo-tasks". Pseudo-tasks should have been tasks, but aren't for some strange reasons. Example: ResourcePool.updateConfig().
 * @param name       pseudo-task name
 * @param eventType  expected completion event
 * @param refId      target for expected event
 * @param obj        code to execute
 * @return moref returned by the task
 * @throws Exception
 */
public ManagedObjectReference execPseudoTask(String name,VcEventType eventType,ManagedObjectReference moRef,IVcPseudoTaskBody obj) throws Exception {
  AuAssert.check(eventType != null);
  AuAssert.check(VcContext.isInTaskSession());
  VcPseudoTask task=pseudoTaskStarted(name,eventType,moRef);
  Profiler.inc(StatsType.VC_TASK_EXEC,task.getName());
  ManagedObjectReference res=null;
  try {
    res=obj.body();
  }
 catch (  Exception e) {
    pseudoTaskFailed(task);
    VcCache.refreshAll(moRef);
    throw e;
  }
  return res;
}

Fixed version (ground truth):
/** 
 * A way to call "VC pseudo-tasks". Pseudo-tasks should have been tasks, but aren't for some strange reasons. Example: ResourcePool.updateConfig().
 * @param name       pseudo-task name
 * @param eventType  expected completion event
 * @param refId      target for expected event
 * @param obj        code to execute
 * @return moref returned by the task
 * @throws Exception
 */
public ManagedObjectReference execPseudoTask(String name,VcEventType eventType,ManagedObjectReference moRef,IVcPseudoTaskBody obj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < MaxRetryNum; i++) {
    try {
      return execPseudoTaskInternal(name,eventType,moRef,obj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        logger.debug("String_Node_Str" + obj,e);
        wait(waitInterval);
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48751
Project: 48751
Buggy source:
/** 
 * Safely execute the task specified by IVcTaskBody object. This is the only safe way to execute tasks to avoid lost completion notifications. A read lock is held until a task moRef is received from VC.
 * @param taskObj   task object
 * @return VcTask    task handle
 * @throws Exception
 */
public VcTask execute(IVcTaskBody taskObj) throws Exception {
  AuAssert.check(VcContext.isInTaskSession());
  VcTask task=null;
  rwLock.readLock().lock();
  try {
    task=taskObj.body();
    Profiler.inc(StatsType.VC_TASK_EXEC,task.getType());
    taskStarted(task);
  }
  finally {
    rwLock.readLock().unlock();
  }
  return task;
}

Fixed version (ground truth):
/** 
 * Safely execute the task specified by IVcTaskBody object. This is the only safe way to execute tasks to avoid lost completion notifications. A read lock is held until a task moRef is received from VC.
 * @param taskObj   task object
 * @return VcTask    task handle
 * @throws Exception
 */
public VcTask execute(IVcTaskBody taskObj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < MaxRetryNum; i++) {
    try {
      return executeInternal(taskObj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        logger.debug("String_Node_Str" + taskObj,e);
        wait(waitInterval);
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48752
Project: 48752
Buggy source:
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.NEW_LINE)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.ESCAPE_CHAR)) {
    return true;
  }
  return false;
}
Program: 48756
Project: 48756
Buggy source:
@Override public Void call() throws Exception {
  long start=System.currentTimeMillis();
  vm=VcCache.getIgnoreMissing(vmId);
  while (System.currentTimeMillis() - start < timeout) {
    boolean stop=VcContext.inVcSessionDo(new VcSession<Boolean>(){
      @Override protected Boolean body() throws Exception {
        if (vm != null && vm.isPoweredOn()) {
          return false;
        }
 else {
          logger.info("String_Node_Str" + "String_Node_Str");
          return true;
        }
      }
    }
);
    int found=0;
    for (    String pgName : portGroups) {
      String ip=VcVmUtil.getIpAddressOfPortGroup(vm,pgName,false);
      if (!ip.equals(Constants.NULL_IPV4_ADDRESS)) {
        logger.info("String_Node_Str" + vmId + "String_Node_Str"+ pgName+ "String_Node_Str"+ ip);
        found+=1;
      }
    }
    if (found == portGroups.size()) {
      break;
    }
    if (stop) {
      break;
    }
    Thread.sleep(checkPeriod);
  }
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  long start=System.currentTimeMillis();
  vm=VcCache.getIgnoreMissing(vmId);
  while (System.currentTimeMillis() - start < timeout) {
    boolean stop=VcContext.inVcSessionDo(new VcSession<Boolean>(){
      @Override protected Boolean body() throws Exception {
        if (vm != null && vm.isPoweredOn()) {
          return false;
        }
 else {
          logger.info("String_Node_Str" + "String_Node_Str");
          return true;
        }
      }
    }
);
    int found=0;
    for (    String pgName : portGroups) {
      String ip=VcVmUtil.getIpAddressOfPortGroup(vm,pgName,false);
      if (!ip.equals(Constants.NULL_IPV4_ADDRESS)) {
        logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ pgName+ "String_Node_Str"+ ip);
        found+=1;
      }
    }
    if (found == portGroups.size()) {
      break;
    }
    if (stop) {
      break;
    }
    Thread.sleep(checkPeriod);
  }
  return null;
}
Program: 48757
Project: 48757
Buggy source:
/** 
 * Blocking wait for task completion. Wait on task's monitor until a notification of a task completion by VcEventListener thread.
 * @return the VC object as a result of this task.
 * @exception on failure
 */
public synchronized VcObject waitForCompletion() throws Exception {
  totalWaitTimeNanos=0;
  Exception catchedException=null;
  for (int i=0; i < maxRetryNum; i++) {
    try {
      return waitForCompletionIntenal();
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        wait(TimeUnit.NANOSECONDS.toMillis(getWaitIntervalNanos()));
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}

Fixed version (ground truth):
/** 
 * Blocking wait for task completion. Wait on task's monitor until a notification of a task completion by VcEventListener thread.
 * @return the VC object as a result of this task.
 * @exception on failure
 */
public synchronized VcObject waitForCompletion() throws Exception {
  totalWaitTimeNanos=0;
  Exception catchedException=null;
  for (int i=0; i < maxRetryNum; i++) {
    try {
      return waitForCompletionIntenal();
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        wait(TimeUnit.NANOSECONDS.toMillis(badTaskWaitIntervalNanos));
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48758
Project: 48758
Buggy source:
/** 
 * A way to call "VC pseudo-tasks". Pseudo-tasks should have been tasks, but aren't for some strange reasons. Example: ResourcePool.updateConfig().
 * @param name       pseudo-task name
 * @param eventType  expected completion event
 * @param refId      target for expected event
 * @param obj        code to execute
 * @return moref returned by the task
 * @throws Exception
 */
public ManagedObjectReference execPseudoTask(String name,VcEventType eventType,ManagedObjectReference moRef,IVcPseudoTaskBody obj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < MaxRetryNum; i++) {
    try {
      return execPseudoTaskInternal(name,eventType,moRef,obj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        logger.debug("String_Node_Str" + obj,e);
        wait(waitInterval);
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}

Fixed version (ground truth):
/** 
 * A way to call "VC pseudo-tasks". Pseudo-tasks should have been tasks, but aren't for some strange reasons. Example: ResourcePool.updateConfig().
 * @param name       pseudo-task name
 * @param eventType  expected completion event
 * @param refId      target for expected event
 * @param obj        code to execute
 * @return moref returned by the task
 * @throws Exception
 */
public ManagedObjectReference execPseudoTask(String name,VcEventType eventType,ManagedObjectReference moRef,IVcPseudoTaskBody obj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < maxRetryNum; i++) {
    try {
      return execPseudoTaskInternal(name,eventType,moRef,obj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e) && (i < maxRetryNum - 1)) {
        logger.debug("String_Node_Str" + name,e);
        wait(waitInterval);
        logger.info("String_Node_Str" + name + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48759
Project: 48759
Buggy source:
/** 
 * Safely execute the task specified by IVcTaskBody object. This is the only safe way to execute tasks to avoid lost completion notifications. A read lock is held until a task moRef is received from VC.
 * @param taskObj   task object
 * @return VcTask    task handle
 * @throws Exception
 */
public VcTask execute(IVcTaskBody taskObj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < MaxRetryNum; i++) {
    try {
      return executeInternal(taskObj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e)) {
        logger.debug("String_Node_Str" + taskObj,e);
        wait(waitInterval);
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}

Fixed version (ground truth):
/** 
 * Safely execute the task specified by IVcTaskBody object. This is the only safe way to execute tasks to avoid lost completion notifications. A read lock is held until a task moRef is received from VC.
 * @param taskObj   task object
 * @return VcTask    task handle
 * @throws Exception
 */
public VcTask execute(IVcTaskBody taskObj) throws Exception {
  Exception catchedException=null;
  for (int i=0; i < maxRetryNum; i++) {
    try {
      return executeInternal(taskObj);
    }
 catch (    Exception e) {
      catchedException=e;
      if (VcUtil.isRecoverableException(e) && (i < maxRetryNum - 1)) {
        logger.debug("String_Node_Str" + taskObj.body().getId(),e);
        wait(waitInterval);
        logger.info("String_Node_Str" + taskObj.body().getId() + "String_Node_Str"+ (i + 1)+ "String_Node_Str");
        continue;
      }
      throw e;
    }
  }
  throw catchedException;
}
Program: 48760
Project: 48760
Buggy source:
public static boolean isRecoverableException(Throwable e){
  return (e instanceof SSLPeerUnverifiedException || e instanceof SocketTimeoutException);
}

Fixed version (ground truth):
public static boolean isRecoverableException(Throwable e){
  return (e instanceof SSLPeerUnverifiedException || e instanceof SocketTimeoutException || e instanceof HostCommunication);
}
Program: 48761
Project: 48761
Buggy source:
@Test public void testSupportedWithHdfs2(){
  ClusterCreate cluster=new ClusterCreate();
  cluster.setDistroVendor(Constants.DEFAULT_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.CDH_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.PHD_VENDOR);
  assertEquals(true,cluster.supportedWithHdfs2());
}

Fixed version (ground truth):
@Test public void testSupportedWithHdfs2(){
  ClusterCreate cluster=new ClusterCreate();
  cluster.setDistroVendor(Constants.DEFAULT_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.CDH_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(true,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.GPHD_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.MAPR_VENDOR);
  cluster.setDistroVersion("String_Node_Str");
  assertEquals(false,cluster.supportedWithHdfs2());
  cluster.setDistroVendor(Constants.PHD_VENDOR);
  assertEquals(true,cluster.supportedWithHdfs2());
}
Program: 48765
Project: 48765
Buggy source:
/** 
 * Load and create cluster from spec file
 * @return cluster spec
 */
public static ClusterCreate loadFromFile(File file) throws FileNotFoundException {
  Reader fileReader=new FileReader(file);
  Gson gson=new Gson();
  return gson.fromJson(fileReader,ClusterCreate.class);
}

Fixed version (ground truth):
/** 
 * Load and create cluster from spec file
 * @return cluster spec
 */
public static ClusterCreate loadFromFile(File file) throws FileNotFoundException {
  Reader fileReader=null;
  try {
    fileReader=new FileReader(file);
    Gson gson=new Gson();
    return gson.fromJson(fileReader,ClusterCreate.class);
  }
  finally {
    if (fileReader != null) {
      try {
        fileReader.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
  }
}
Program: 48767
Project: 48767
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());
    }
    startVMEventProcessor();
    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);
    elasticityScheduleMgr.start();
    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());
    }
    startVMEventProcessor();
    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);
    elasticityScheduleMgr.start();
    configureAlarm();
    initialized=true;
  }
}
Program: 48768
Project: 48768
Buggy source:
private Map<String,Folder> executeFolderCreationProcedures(ClusterCreate cluster,Callable<Void>[] storeProcedures){
  Map<String,Folder> folders=new HashMap<String,Folder>();
  try {
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProcedures,callback);
    if (result == null) {
      logger.error("String_Node_Str");
      throw ClusteringServiceException.CREATE_FOLDER_FAILED(cluster.getName());
    }
    int total=0;
    boolean success=true;
    for (int i=0; i < storeProcedures.length; i++) {
      CreateVMFolderSP sp=(CreateVMFolderSP)storeProcedures[i];
      if (result[i].finished && result[i].throwable == null) {
        ++total;
        Folder childFolder=sp.getResult().get(sp.getResult().size() - 1);
        folders.put(childFolder.getName(),childFolder);
      }
 else       if (result[i].throwable != null) {
        logger.error("String_Node_Str",result[i].throwable);
        success=false;
      }
    }
    logger.info(total + "String_Node_Str");
    if (!success) {
      throw ClusteringServiceException.CREATE_FOLDER_FAILED(cluster.getName());
    }
    return folders;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}

Fixed version (ground truth):
private Map<String,Folder> executeFolderCreationProcedures(ClusterCreate cluster,Callable<Void>[] storeProcedures){
  Map<String,Folder> folders=new HashMap<String,Folder>();
  try {
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProcedures,callback);
    if (result == null) {
      logger.error("String_Node_Str");
      if (cluster != null)       throw ClusteringServiceException.CREATE_FOLDER_FAILED(cluster.getName());
    }
    int total=0;
    boolean success=true;
    for (int i=0; i < storeProcedures.length; i++) {
      CreateVMFolderSP sp=(CreateVMFolderSP)storeProcedures[i];
      if (result[i].finished && result[i].throwable == null) {
        ++total;
        Folder childFolder=sp.getResult().get(sp.getResult().size() - 1);
        folders.put(childFolder.getName(),childFolder);
      }
 else       if (result[i].throwable != null) {
        logger.error("String_Node_Str",result[i].throwable);
        success=false;
      }
    }
    logger.info(total + "String_Node_Str");
    if (!success) {
      if (cluster != null)       throw ClusteringServiceException.CREATE_FOLDER_FAILED(cluster.getName());
    }
    return folders;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}
Program: 48771
Project: 48771
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_REQUIREMENT);
    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;
  }
  if (containInvalidCharacter(password)) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_CHARACTER_REQUIREMENT);
    return false;
  }
  return true;
}
Program: 48772
Project: 48772
Buggy source:
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;
}

Fixed version (ground truth):
private String getPassword(){
  System.out.println("String_Node_Str" + Constants.PASSWORD_HINT);
  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: 48773
Project: 48773
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: 48774
Project: 48774
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: 48775
Project: 48775
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: 48780
Project: 48780
Buggy source:
/** 
 * Reverse to the previous function: given a string in the format MOREF_GUID_FORMAT, return ManagedObjectReference. Returns null if the string has incorrect format.
 */
public static ManagedObjectReference stringToMoref(String str){
  String[] comps=str.split("String_Node_Str");
  if (comps.length != 2 && comps.length != 3) {
    return null;
  }
  for (int i=0; i < comps.length; i++) {
    if (comps[i] != null && (comps[i].equals("String_Node_Str") || comps[i].equals("String_Node_Str"))) {
      comps[i]=null;
    }
  }
  ManagedObjectReference ref=new ManagedObjectReference();
  if (comps.length == 2) {
    ref.setServerGuid(null);
    ref.setType(comps[0]);
    ref.setValue(comps[1]);
  }
 else {
    ref.setServerGuid(comps[0]);
    ref.setType(comps[1]);
    ref.setValue(comps[2]);
  }
  if (ref.getType() == null || ref.getValue() == null || (ref.getServerGuid() != null && !ref.getServerGuid().equals(VcContext.getServerGuid()))) {
    return null;
  }
  return ref;
}

Fixed version (ground truth):
/** 
 * Reverse to the previous function: given a string in the format MOREF_GUID_FORMAT, return ManagedObjectReference. Returns null if the string has incorrect format.
 */
public static ManagedObjectReference stringToMoref(String str){
  if (str == null) {
    return null;
  }
  String[] comps=str.split("String_Node_Str");
  if (comps.length != 2 && comps.length != 3) {
    return null;
  }
  for (int i=0; i < comps.length; i++) {
    if (comps[i] != null && (comps[i].equals("String_Node_Str") || comps[i].equals("String_Node_Str"))) {
      comps[i]=null;
    }
  }
  ManagedObjectReference ref=new ManagedObjectReference();
  if (comps.length == 2) {
    ref.setServerGuid(null);
    ref.setType(comps[0]);
    ref.setValue(comps[1]);
  }
 else {
    ref.setServerGuid(comps[0]);
    ref.setType(comps[1]);
    ref.setValue(comps[2]);
  }
  if (ref.getType() == null || ref.getValue() == null || (ref.getServerGuid() != null && !ref.getServerGuid().equals(VcContext.getServerGuid()))) {
    return null;
  }
  return ref;
}
Program: 48781
Project: 48781
Buggy source:
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);
  List<NetworkAdd> networkAdds=clusterSpec.getNetworkings();
  GuestMachineIdSpec machineIdSpec=new GuestMachineIdSpec(networkAdds,node.fetchPortGroupToIpMap(),node.getIpConfigsInfo().get(NetConfigInfo.NetTrafficType.MGT_NETWORK).get(0).getPortGroupName());
  logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ machineIdSpec.toString());
  Map<String,String> guestVariable=machineIdSpec.toGuestVarialbe();
  VcVmUtil.addBootupUUID(guestVariable);
  String haFlag=clusterSpec.getNodeGroup(groupName).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;
  }
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema,ha,ft);
  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);
  List<NetworkAdd> networkAdds=clusterSpec.getNetworkings();
  GuestMachineIdSpec machineIdSpec=new GuestMachineIdSpec(networkAdds,node.fetchPortGroupToIpMap(),node.getIpConfigsInfo().get(NetConfigInfo.NetTrafficType.MGT_NETWORK).get(0).getPortGroupName());
  logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ machineIdSpec.toString());
  Map<String,String> guestVariable=machineIdSpec.toGuestVarialbe();
  VcVmUtil.addBootupUUID(guestVariable);
  String haFlag=clusterSpec.getNodeGroup(groupName).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;
  }
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema,ha,ft);
  return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,null,guestVariable,false,getTargetFolder(node),getTargetHost(node));
}