nus-yam/ex-repair huggingface dataset:
Program: 48879
Project: 48879
Buggy source:
@Test(groups={"String_Node_Str"}) public void deleteNetwork(){
  new Expectations(){
{
      resService.isNetworkExistInVc(anyString);
      result=true;
    }
  }
;
  networkSvc.setResService(resService);
  networkSvc.setNetworkDao(networkDao);
  networkSvc.setClusterDAO(clusterDAO);
  networkSvc.addDhcpNetwork("String_Node_Str","String_Node_Str");
  new Verifications(){
{
      networkDao.insert(withAny(new NetworkEntity()));
    }
  }
;
  new Expectations(){
{
      NetworkEntity network=new NetworkEntity();
      network.setIpBlocks(new ArrayList<IpBlockEntity>());
      networkDao.findNetworkByName(anyString);
      result=network;
      networkDao.delete(withAny(network));
    }
  }
;
  networkSvc.removeNetwork("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void deleteNetwork(){
  new Expectations(){
{
      resService.isNetworkExistInVc(anyString);
      result=true;
    }
  }
;
  networkSvc.setResService(resService);
  networkSvc.setNetworkDao(networkDao);
  networkSvc.setClusterDAO(clusterDAO);
  networkSvc.addDhcpNetwork("String_Node_Str","String_Node_Str");
  new Verifications(){
{
      networkDao.insert(withAny(new NetworkEntity()));
    }
  }
;
  new Expectations(){
{
      NetworkEntity network=new NetworkEntity();
      network.setIpBlocks(new ArrayList<IpBlockEntity>());
      networkDao.findNetworkByName("String_Node_Str");
      result=network;
      networkDao.delete(withAny(network));
    }
  }
;
  networkSvc.removeNetwork("String_Node_Str");
}
Program: 48886
Project: 48886
Buggy source:
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedDatastorePattern(null);
  spec.setLocalDatastorePattern(null);
  spec.setNetworkings(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkConfig(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setSpecFile(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setImagestoreNamePattern(null);
      group.getStorage().setDiskstoreNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
      if (group.getPlacementPolicies() != null) {
        List<GroupAssociation> associations=group.getPlacementPolicies().getGroupAssociations();
        if (associations != null && associations.isEmpty()) {
          group.getPlacementPolicies().setGroupAssociations(null);
        }
      }
    }
  }
  return spec;
}

Fixed version (ground truth):
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedDatastorePattern(null);
  spec.setLocalDatastorePattern(null);
  spec.setNetworkings(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkConfig(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setSpecFile(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  spec.setPassword(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setImagestoreNamePattern(null);
      group.getStorage().setDiskstoreNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
      if (group.getPlacementPolicies() != null) {
        List<GroupAssociation> associations=group.getPlacementPolicies().getGroupAssociations();
        if (associations != null && associations.isEmpty()) {
          group.getPlacementPolicies().setGroupAssociations(null);
        }
      }
    }
  }
  return spec;
}
Program: 48887
Project: 48887
Buggy source:
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedDatastorePattern(null);
  spec.setLocalDatastorePattern(null);
  spec.setNetworkings(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkConfig(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setSpecFile(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setImagestoreNamePattern(null);
      group.getStorage().setDiskstoreNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
      if (group.getPlacementPolicies() != null) {
        List<GroupAssociation> associations=group.getPlacementPolicies().getGroupAssociations();
        if (associations != null && associations.isEmpty()) {
          group.getPlacementPolicies().setGroupAssociations(null);
        }
      }
    }
  }
  return spec;
}

Fixed version (ground truth):
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedDatastorePattern(null);
  spec.setLocalDatastorePattern(null);
  spec.setNetworkings(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkConfig(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setSpecFile(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  spec.setPassword(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setImagestoreNamePattern(null);
      group.getStorage().setDiskstoreNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
      if (group.getPlacementPolicies() != null) {
        List<GroupAssociation> associations=group.getPlacementPolicies().getGroupAssociations();
        if (associations != null && associations.isEmpty()) {
          group.getPlacementPolicies().setGroupAssociations(null);
        }
      }
    }
  }
  return spec;
}
Program: 48890
Project: 48890
Buggy source:
@Transactional synchronized public void refreshNodeByVmName(String vmId,String vmName,String nodeAction,boolean inSession){
  NodeEntity node=nodeDao.findByName(vmName);
  if (node != null) {
    node.setMoId(vmId);
    refreshNodeStatus(node,inSession);
    node.setAction(nodeAction);
  }
}

Fixed version (ground truth):
@Transactional synchronized public void refreshNodeByVmName(String vmId,String vmName,String nodeAction,boolean inSession){
  NodeEntity node=nodeDao.findByName(vmName);
  if (node != null) {
    node.setMoId(vmId);
    node.setAction(nodeAction);
    refreshNodeStatus(node,inSession);
  }
}
Program: 48891
Project: 48891
Buggy source:
@Transactional synchronized public void refreshNodeByMobId(String vmId,String action,boolean inSession){
  NodeEntity node=nodeDao.findByMobId(vmId);
  if (node != null) {
    refreshNodeStatus(node,inSession);
    node.setAction(action);
  }
}

Fixed version (ground truth):
@Transactional synchronized public void refreshNodeByMobId(String vmId,String action,boolean inSession){
  NodeEntity node=nodeDao.findByMobId(vmId);
  if (node != null) {
    node.setAction(action);
    refreshNodeStatus(node,inSession);
  }
}
Program: 48892
Project: 48892
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 (node.isPowerStatusChanged()) {
    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.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.setAction(null);
      }
    }
    String guestHostName=VcVmUtil.getGuestHostName(vcVm,inSession);
    if (guestHostName != null) {
      node.setGuestHostName(guestHostName);
    }
  }
  node.setHostName(vcVm.getHost().getName());
  update(node);
}
Program: 48894
Project: 48894
Buggy source:
private List<VcCluster> getUsedVcClusters(List<String> rpNames){
  List<VcCluster> clusters=null;
  if (rpNames == null || rpNames.isEmpty()) {
    clusters=clusterConfigMgr.getRpMgr().getAllVcResourcePool();
  }
 else {
    clusters=new ArrayList<VcCluster>();
    for (    String rpName : rpNames) {
      clusters.addAll(clusterConfigMgr.getRpMgr().getVcResourcePoolByName(rpName));
    }
  }
  return clusters;
}

Fixed version (ground truth):
private List<VcCluster> getUsedVcClusters(List<String> rpNames){
  List<VcCluster> clusters=null;
  if (rpNames == null || rpNames.isEmpty()) {
    clusters=clusterConfigMgr.getRpMgr().getAllVcResourcePool();
  }
 else {
    clusters=new ArrayList<VcCluster>();
    StringBuffer nonexistentRpNames=new StringBuffer();
    for (    String rpName : rpNames) {
      List<VcCluster> vcClusters=clusterConfigMgr.getRpMgr().getVcResourcePoolByName(rpName);
      if (vcClusters == null) {
        nonexistentRpNames.append(rpName).append("String_Node_Str");
      }
 else {
        clusters.addAll(vcClusters);
      }
    }
    if (nonexistentRpNames.length() > 0) {
      nonexistentRpNames.delete(nonexistentRpNames.length() - 1,nonexistentRpNames.length());
      throw VcProviderException.RESOURCE_POOL_NOT_FOUND(nonexistentRpNames.toString());
    }
  }
  return clusters;
}
Program: 48896
Project: 48896
Buggy source:
protected boolean isTaskSession(){
  return true;
}

Fixed version (ground truth):
@Override protected boolean isTaskSession(){
  return true;
}
Program: 48897
Project: 48897
Buggy source:
@Override protected Void body() throws Exception {
  FlagInfo flagInfo=new FlagInfoImpl();
  flagInfo.setDiskUuidEnabled(true);
  ConfigSpec configSpec=new ConfigSpecImpl();
  configSpec.setFlags(flagInfo);
  vm.reconfigure(configSpec);
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  final VcVirtualMachine template=VcCache.get(vmSchema.diskSchema.getParent());
  VcSnapshot snap=template.getSnapshotByName(vmSchema.diskSchema.getParentSnap());
  if (snap == null) {
    snap=template.createSnapshot(vmSchema.diskSchema.getParentSnap(),"String_Node_Str");
  }
  return null;
}
Program: 48899
Project: 48899
Buggy source:
private List<ManagedObjectReference> getSharedDatastoreInt() throws Exception {
  AuAssert.check(VcContext.isInSession());
  List<HostSystem> hostList=MoUtil.getManagedObjects(host);
  List<ManagedObjectReference> results=new ArrayList<ManagedObjectReference>();
  DatastoreInfo[] candidateList=null;
  HashMap<String,Integer> map=new HashMap<String,Integer>();
  if (hostList.size() == 0) {
    return results;
  }
  for (  HostSystem h : hostList) {
    DatastoreInfo[] info=h.queryConnectionInfo().getDatastore();
    if (candidateList == null) {
      candidateList=info;
    }
    for (    DatastoreInfo n : info) {
      String name=n.getSummary().getName();
      Integer count=map.get(name);
      if (count != null) {
        map.put(name,count + 1);
      }
 else {
        map.put(name,Integer.valueOf(1));
      }
    }
  }
  for (  DatastoreInfo n : candidateList) {
    if (map.get(n.getSummary().getName()).equals(hostList.size())) {
      results.add(n.getSummary().getDatastore());
    }
  }
  return results;
}

Fixed version (ground truth):
private List<ManagedObjectReference> getSharedDatastoreInt() throws Exception {
  AuAssert.check(VcContext.isInSession());
  List<HostSystem> hostList=MoUtil.getManagedObjects(host);
  List<ManagedObjectReference> results=new ArrayList<ManagedObjectReference>();
  DatastoreInfo[] candidateList=null;
  HashMap<String,Integer> map=new HashMap<String,Integer>();
  if (hostList.size() == 0) {
    return results;
  }
  for (  HostSystem h : hostList) {
    DatastoreInfo[] info=h.queryConnectionInfo().getDatastore();
    if (info == null)     continue;
    if (candidateList == null) {
      candidateList=info;
    }
    for (    DatastoreInfo n : info) {
      String name=n.getSummary().getName();
      Integer count=map.get(name);
      if (count != null) {
        map.put(name,count + 1);
      }
 else {
        map.put(name,Integer.valueOf(1));
      }
    }
  }
  if (candidateList != null) {
    for (    DatastoreInfo n : candidateList) {
      if (map.get(n.getSummary().getName()).equals(hostList.size())) {
        results.add(n.getSummary().getDatastore());
      }
    }
  }
  return results;
}
Program: 48900
Project: 48900
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("String_Node_Str").append(msg);
  }
  tmpMsg.replace(0,1,"String_Node_Str");
  failedMsg.append(tmpMsg);
  failedMsg.append("String_Node_Str");
  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);
  }
  failedMsg.append(tmpMsg);
  CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,failedMsg.toString());
}
Program: 48901
Project: 48901
Buggy source:
private void collectInstanceNumInvalidateMsg(NodeGroupCreate nodeGroup,List<String> failedMsgList){
  failedMsgList.add(new StringBuilder().append(nodeGroup.getName()).append("String_Node_Str").append("String_Node_Str").append(nodeGroup.getInstanceNum()).toString());
}

Fixed version (ground truth):
private void collectInstanceNumInvalidateMsg(NodeGroupCreate nodeGroup,List<String> failedMsgList){
  failedMsgList.add(new StringBuilder().append(nodeGroup.getName()).append("String_Node_Str").append("String_Node_Str").append(nodeGroup.getInstanceNum()).append("String_Node_Str").toString());
}
Program: 48903
Project: 48903
Buggy source:
public String getVersion(){
  return "String_Node_Str";
}

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

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

Fixed version (ground truth):
public String getBanner(){
  StringBuilder buf=new StringBuilder();
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + this.getVersion());
  return buf.toString();
}
Program: 48906
Project: 48906
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public String getHello(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public String getHello(){
  return Constants.VERSION;
}
Program: 48907
Project: 48907
Buggy source:
public String retrieveVhmTargetNum(){
  if (vhmTargetNum == null) {
    return "String_Node_Str";
  }
 else {
    return vhmTargetNum.toString();
  }
}

Fixed version (ground truth):
public String retrieveVhmTargetNum(){
  if (vhmTargetNum == null || vhmTargetNum == -1) {
    return "String_Node_Str";
  }
 else {
    return vhmTargetNum.toString();
  }
}
Program: 48908
Project: 48908
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);
  }
 else {
    node.setStatus(NodeStatus.POWERED_ON);
  }
  if (node.isPowerStatusChanged()) {
    if (vcVm.isPoweredOn()) {
      String ipAddress=VcVmUtil.getIpAddress(vcVm,inSession);
      if (ipAddress != null) {
        node.setStatus(NodeStatus.VM_READY);
        node.setIpAddress(ipAddress);
        if (node.getAction() != null && node.getAction().equals(Constants.NODE_ACTION_WAITING_IP)) {
          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.setIpAddress(null);
  }
 else {
    node.setStatus(NodeStatus.POWERED_ON);
  }
  if (node.isPowerStatusChanged()) {
    if (vcVm.isPoweredOn()) {
      String ipAddress=VcVmUtil.getIpAddress(vcVm,inSession);
      if (ipAddress != null) {
        node.setStatus(NodeStatus.VM_READY);
        node.setIpAddress(ipAddress);
        if (node.getAction() != null && node.getAction().equals(Constants.NODE_ACTION_WAITING_IP)) {
          node.setAction(null);
        }
      }
      String guestHostName=VcVmUtil.getGuestHostName(vcVm,inSession);
      if (guestHostName != null) {
        node.setGuestHostName(guestHostName);
      }
    }
    node.setHostName(vcVm.getHost().getName());
  }
  update(node);
}
Program: 48909
Project: 48909
Buggy source:
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      try {
        FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
        if (info != null && info.getRole() == 1) {
          logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
          vcVm.turnOffFT();
        }
        if (vcVm.isPoweredOn()) {
          vcVm.powerOff();
        }
        vcVm.destroy();
        return null;
      }
 catch (      ManagedObjectNotFound e) {
        VcUtil.processNotFoundException(e,vmId,logger);
        return null;
      }
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      try {
        FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
        if (info != null && info.getRole() == 1) {
          logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
          vcVm.turnOffFT();
        }
        if (vcVm.isPoweredOn()) {
          vcVm.powerOff();
        }
        vcVm.destroy();
        return null;
      }
 catch (      ManagedObjectNotFound e) {
        VcUtil.processNotFoundException(e,vmId,logger);
        return null;
      }
catch (      Exception e) {
        if (vcVm.getConnectionState() == ConnectionState.inaccessible) {
          logger.error("String_Node_Str" + vcVm.getName(),e);
          logger.info("String_Node_Str" + vcVm.getName());
          vcVm.unregister();
          return null;
        }
 else {
          throw e;
        }
      }
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}
Program: 48910
Project: 48910
Buggy source:
@Override protected Void body() throws Exception {
  try {
    FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
    if (info != null && info.getRole() == 1) {
      logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
      vcVm.turnOffFT();
    }
    if (vcVm.isPoweredOn()) {
      vcVm.powerOff();
    }
    vcVm.destroy();
    return null;
  }
 catch (  ManagedObjectNotFound e) {
    VcUtil.processNotFoundException(e,vmId,logger);
    return null;
  }
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  try {
    FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
    if (info != null && info.getRole() == 1) {
      logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
      vcVm.turnOffFT();
    }
    if (vcVm.isPoweredOn()) {
      vcVm.powerOff();
    }
    vcVm.destroy();
    return null;
  }
 catch (  ManagedObjectNotFound e) {
    VcUtil.processNotFoundException(e,vmId,logger);
    return null;
  }
catch (  Exception e) {
    if (vcVm.getConnectionState() == ConnectionState.inaccessible) {
      logger.error("String_Node_Str" + vcVm.getName(),e);
      logger.info("String_Node_Str" + vcVm.getName());
      vcVm.unregister();
      return null;
    }
 else {
      throw e;
    }
  }
}
Program: 48911
Project: 48911
Buggy source:
public VcEventRouter(){
  VcEventListener.installExtEventHandler(vmEvents,new IVcEventHandler(){
    @Override public boolean eventHandler(    VcEventType type,    Event e) throws Exception {
      AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
      ManagedObjectReference moRef=e.getVm().getVm();
switch (type) {
case VmRemoved:
{
          VcCache.purge(moRef);
          ManagedObjectReference rpMoRef=VcCache.removeVmRpPair(moRef);
          if (rpMoRef != null) {
            VcCache.refresh(rpMoRef);
          }
          return false;
        }
case VmResourcePoolMoved:
{
        VmResourcePoolMovedEvent event=(VmResourcePoolMovedEvent)e;
        VcCache.refresh(event.getOldParent().getResourcePool());
        VcCache.refresh(event.getNewParent().getResourcePool());
        break;
      }
case VmCreated:
{
      VmCreatedEvent event=(VmCreatedEvent)e;
      VcVirtualMachine vm=VcCache.get(event.getVm().getVm());
      vm.refreshRP();
      break;
    }
}
VcCache.refreshAll(moRef);
return false;
}
}
);
VcEventListener.installExtEventHandler(rpEvents,new IVcEventHandler(){
@Override public boolean eventHandler(VcEventType type,Event e) throws Exception {
ManagedObjectReference moRef=((ResourcePoolEvent)e).getResourcePool().getResourcePool();
if (type == VcEventType.ResourcePoolDestroyed) {
  VcCache.purge(moRef);
}
 else {
  VcCache.refreshAll(moRef);
}
return false;
}
}
);
}

Fixed version (ground truth):
public VcEventRouter(){
  VcEventListener.installExtEventHandler(vmEvents,new IVcEventHandler(){
    @Override public boolean eventHandler(    VcEventType type,    Event e) throws Exception {
      AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
      ManagedObjectReference moRef=e.getVm().getVm();
switch (type) {
case VmRemoved:
{
          VcCache.purge(moRef);
          ManagedObjectReference rpMoRef=VcCache.removeVmRpPair(moRef);
          if (rpMoRef != null) {
            VcCache.refresh(rpMoRef);
          }
          return false;
        }
case VmDisconnected:
case VmConnected:
{
        VcVirtualMachine vm=VcCache.getIgnoreMissing(moRef);
        if (vm == null) {
          return false;
        }
        vm.update();
      }
case VmResourcePoolMoved:
{
      VmResourcePoolMovedEvent event=(VmResourcePoolMovedEvent)e;
      VcCache.refresh(event.getOldParent().getResourcePool());
      VcCache.refresh(event.getNewParent().getResourcePool());
      break;
    }
case VmCreated:
{
    VmCreatedEvent event=(VmCreatedEvent)e;
    VcVirtualMachine vm=VcCache.get(event.getVm().getVm());
    vm.refreshRP();
    break;
  }
}
VcCache.refreshAll(moRef);
return false;
}
}
);
VcEventListener.installExtEventHandler(rpEvents,new IVcEventHandler(){
@Override public boolean eventHandler(VcEventType type,Event e) throws Exception {
ManagedObjectReference moRef=((ResourcePoolEvent)e).getResourcePool().getResourcePool();
if (type == VcEventType.ResourcePoolDestroyed) {
VcCache.purge(moRef);
}
 else {
VcCache.refreshAll(moRef);
}
return false;
}
}
);
}
Program: 48912
Project: 48912
Buggy source:
public static VcProviderException MEMORY_EXCEED_LIMIT(String vmName){
  return new VcProviderException(null,"String_Node_Str",vmName);
}

Fixed version (ground truth):
public static VcProviderException MEMORY_EXCEED_LIMIT(long memory,long maxMemory,String vmName){
  return new VcProviderException(null,"String_Node_Str",memory,maxMemory,vmName);
}
Program: 48913
Project: 48913
Buggy source:
public static VcProviderException CPU_EXCEED_LIMIT(String vmName){
  return new VcProviderException(null,"String_Node_Str",vmName);
}

Fixed version (ground truth):
public static VcProviderException CPU_EXCEED_LIMIT(int cpuNumber,int maxCpuNumber,String vmName){
  return new VcProviderException(null,"String_Node_Str",cpuNumber,maxCpuNumber,vmName);
}
Program: 48914
Project: 48914
Buggy source:
public Priority getShares(){
  return shares;
}

Fixed version (ground truth):
@JsonIgnore public Priority getShares(){
  return shares;
}
Program: 48915
Project: 48915
Buggy source:
@Override public boolean scaleNodeResource(String nodeName,int cpuNumber,long memory){
  logger.info("String_Node_Str" + nodeName + "String_Node_Str"+ cpuNumber+ "String_Node_Str"+ memory);
  NodeEntity node=clusterEntityMgr.findNodeByName(nodeName);
  DiskEntity swapDisk=findSwapDisk(node);
  VcDatastore targetDs=null;
  long newSwapSizeInMB=0;
  if (memory > getVmOriginalMemory(nodeName)) {
    newSwapSizeInMB=(((long)Math.ceil(memory * node.getNodeGroup().getSwapRatio()) + 1023) / 1024) * 1024;
    logger.info("String_Node_Str" + newSwapSizeInMB);
    targetDs=getTargetDsForSwapDisk(node,swapDisk,newSwapSizeInMB);
  }
  ScaleVMSP scaleVMSP=new ScaleVMSP(node.getMoId(),cpuNumber,memory,targetDs,swapDisk,newSwapSizeInMB);
  boolean vmResult=VcVmUtil.runSPOnSingleVM(node,scaleVMSP);
  return vmResult;
}

Fixed version (ground truth):
@Override public boolean scaleNodeResource(String nodeName,int cpuNumber,long memory){
  logger.info("String_Node_Str" + nodeName + "String_Node_Str"+ cpuNumber+ "String_Node_Str"+ memory);
  NodeEntity node=clusterEntityMgr.findNodeByName(nodeName);
  DiskEntity swapDisk=findSwapDisk(node);
  VcDatastore targetDs=null;
  long newSwapSizeInMB=0;
  if (memory > 0) {
    newSwapSizeInMB=(((long)Math.ceil(memory * node.getNodeGroup().getSwapRatio()) + 1023) / 1024) * 1024;
    logger.info("String_Node_Str" + newSwapSizeInMB);
    targetDs=getTargetDsForSwapDisk(node,swapDisk,newSwapSizeInMB);
  }
  ScaleVMSP scaleVMSP=new ScaleVMSP(node.getMoId(),cpuNumber,memory,targetDs,swapDisk,newSwapSizeInMB);
  boolean vmResult=VcVmUtil.runSPOnSingleVM(node,scaleVMSP);
  return vmResult;
}
Program: 48917
Project: 48917
Buggy source:
@Override protected Void body() throws Exception {
  ConfigSpecImpl newConfigSpec=new ConfigSpecImpl();
  if (cpuNumber > 0) {
    newConfigSpec.setNumCPUs(cpuNumber);
  }
  if (memory > 0) {
    VmConfigUtil.setMemoryAndBalloon(newConfigSpec,memory);
    if (targetDs != null) {
      VirtualDisk vmSwapDisk=VcVmUtil.findVirtualDisk(vmId,swapDisk.getExternalAddress());
      logger.info("String_Node_Str" + swapDisk.getDatastoreName());
      logger.info("String_Node_Str" + targetDs.getName());
      if (swapDisk.getDatastoreMoId().equals(targetDs.getId())) {
        VirtualDeviceSpec devSpec=new VirtualDeviceSpecImpl();
        devSpec.setOperation(VirtualDeviceSpec.Operation.edit);
        vmSwapDisk.setCapacityInKB(newSwapSizeInMB * 1024);
        devSpec.setDevice(vmSwapDisk);
        VirtualDeviceSpec[] changes={devSpec};
        newConfigSpec.setDeviceChange(changes);
        logger.info("String_Node_Str");
      }
 else {
        vcVm.detachVirtualDisk(new DeviceId(swapDisk.getExternalAddress()),true);
        AllocationType allocType=swapDisk.getAllocType() == null ? null : AllocationType.valueOf(swapDisk.getAllocType());
        DiskCreateSpec[] addDisks={new DiskCreateSpec(new DeviceId(swapDisk.getExternalAddress()),targetDs,swapDisk.getName(),DiskMode.independent_persistent,DiskSize.sizeFromMB(newSwapSizeInMB),allocType)};
        vcVm.changeDisks(null,addDisks);
      }
    }
  }
  vcVm.reconfigure(newConfigSpec);
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  ConfigSpecImpl newConfigSpec=new ConfigSpecImpl();
  if (cpuNumber > 0) {
    newConfigSpec.setNumCPUs(cpuNumber);
  }
  if (memory > 0) {
    VmConfigUtil.setMemoryAndBalloon(newConfigSpec,memory);
    if (targetDs != null) {
      logger.info("String_Node_Str" + swapDisk.getDatastoreName());
      logger.info("String_Node_Str" + targetDs.getName());
      vcVm.detachVirtualDisk(new DeviceId(swapDisk.getExternalAddress()),true);
      AllocationType allocType=swapDisk.getAllocType() == null ? null : AllocationType.valueOf(swapDisk.getAllocType());
      DiskCreateSpec[] addDisks={new DiskCreateSpec(new DeviceId(swapDisk.getExternalAddress()),targetDs,swapDisk.getName(),DiskMode.independent_persistent,DiskSize.sizeFromMB(newSwapSizeInMB),allocType)};
      vcVm.changeDisks(null,addDisks);
    }
  }
  vcVm.reconfigure(newConfigSpec);
  return null;
}
Program: 48919
Project: 48919
Buggy source:
/** 
 * cluster create, resize, resume will all call this method for static ip allocation the network contains all allocated ip address to this cluster, so some of them may already be occupied by existing node. So we need to detect if that ip is allocated, before assign that one to one node
 * @param networkAdd
 * @param vNodes
 * @param occupiedIps
 */
private void allocateStaticIp(NetworkAdd networkAdd,List<BaseNode> vNodes,Set<String> occupiedIps){
  if (networkAdd.isDhcp()) {
    logger.info("String_Node_Str");
    return;
  }
  logger.info("String_Node_Str");
  List<String> availableIps=IpBlock.getIpAddressFromIpBlock(networkAdd.getIp());
  AuAssert.check(availableIps.size() == vNodes.size());
  for (int i=0; i < availableIps.size(); i++) {
    if (occupiedIps.contains(availableIps.get(i))) {
      continue;
    }
    vNodes.get(i).setIpAddress(availableIps.get(i));
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * cluster create, resize, resume will all call this method for static ip allocation the network contains all allocated ip address to this cluster, so some of them may already be occupied by existing node. So we need to detect if that ip is allocated, before assign that one to one node
 * @param networkAdd
 * @param vNodes
 * @param occupiedIps
 */
private void allocateStaticIp(NetworkAdd networkAdd,List<BaseNode> vNodes,Set<String> occupiedIps){
  if (networkAdd.isDhcp()) {
    logger.info("String_Node_Str");
    return;
  }
  logger.info("String_Node_Str");
  List<String> availableIps=IpBlock.getIpAddressFromIpBlock(networkAdd.getIp());
  availableIps.removeAll(occupiedIps);
  AuAssert.check(availableIps.size() == vNodes.size());
  for (int i=0; i < availableIps.size(); i++) {
    vNodes.get(i).setIpAddress(availableIps.get(i));
  }
  logger.info("String_Node_Str");
}
Program: 48923
Project: 48923
Buggy source:
@Override protected Integer body() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return -1;
  }
  VirtualMachine vimVm=vcVm.getManagedObject();
  EnvironmentBrowser envBrowser=MoUtil.getManagedObject(vimVm.getEnvironmentBrowser());
  ConfigOption configOption=envBrowser.queryConfigOption(null,null);
  int hardwareVersion=configOption.getHardwareOptions().getHwVersion();
  logger.info("String_Node_Str" + hardwareVersion);
  return hardwareVersion;
}

Fixed version (ground truth):
@Override protected Integer body() throws Exception {
  VirtualMachine vimVm=vcVm.getManagedObject();
  EnvironmentBrowser envBrowser=MoUtil.getManagedObject(vimVm.getEnvironmentBrowser());
  ConfigOption configOption=envBrowser.queryConfigOption(null,null);
  int hardwareVersion=configOption.getHardwareOptions().getHwVersion();
  logger.info("String_Node_Str" + hardwareVersion);
  return hardwareVersion;
}
Program: 48924
Project: 48924
Buggy source:
public static void checkVmMaxConfiguration(final String vmId,final int cpuNumber,final long memory){
  int hardwareVersion=VcContext.inVcSessionDo(new VcSession<Integer>(){
    @Override protected Integer body() throws Exception {
      final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
      if (vcVm == null) {
        logger.info("String_Node_Str" + vmId + "String_Node_Str");
        return -1;
      }
      VirtualMachine vimVm=vcVm.getManagedObject();
      EnvironmentBrowser envBrowser=MoUtil.getManagedObject(vimVm.getEnvironmentBrowser());
      ConfigOption configOption=envBrowser.queryConfigOption(null,null);
      int hardwareVersion=configOption.getHardwareOptions().getHwVersion();
      logger.info("String_Node_Str" + hardwareVersion);
      return hardwareVersion;
    }
  }
);
  compareMaxConfiguration(vmId,hardwareVersion,cpuNumber,memory);
}

Fixed version (ground truth):
public static void checkVmMaxConfiguration(final String vmId,final int cpuNumber,final long memory){
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  int hardwareVersion=0;
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    hardwareVersion=-1;
  }
 else {
    hardwareVersion=VcContext.inVcSessionDo(new VcSession<Integer>(){
      @Override protected Integer body() throws Exception {
        VirtualMachine vimVm=vcVm.getManagedObject();
        EnvironmentBrowser envBrowser=MoUtil.getManagedObject(vimVm.getEnvironmentBrowser());
        ConfigOption configOption=envBrowser.queryConfigOption(null,null);
        int hardwareVersion=configOption.getHardwareOptions().getHwVersion();
        logger.info("String_Node_Str" + hardwareVersion);
        return hardwareVersion;
      }
    }
);
  }
  compareMaxConfiguration(vcVm.getName(),hardwareVersion,cpuNumber,memory);
}
Program: 48926
Project: 48926
Buggy source:
/** 
 * Disconnect the session
 */
public void disconnect(){
  try {
    checkConnection();
    logout(Constants.REST_PATH_LOGOUT,String.class);
  }
 catch (  CliRestException cliRestException) {
    if (cliRestException.getStatus() == HttpStatus.UNAUTHORIZED) {
      writeCookieInfo("String_Node_Str");
    }
  }
catch (  Exception e) {
    System.out.println(Constants.DISCONNECT_FAILURE + "String_Node_Str" + getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Disconnect the session
 */
public void disconnect(){
  try {
    checkConnection();
    logout(Constants.REST_PATH_LOGOUT,String.class);
  }
 catch (  CliRestException cliRestException) {
    if (cliRestException.getStatus() == HttpStatus.UNAUTHORIZED) {
      writeCookieInfo("String_Node_Str");
    }
  }
catch (  Exception e) {
    System.out.println(Constants.DISCONNECT_FAILURE + "String_Node_Str" + CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48927
Project: 48927
Buggy source:
/** 
 * Update an object
 * @param entity the updated content
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput output callback
 */
public void update(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restUpdate(path,entity);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Update an object
 * @param entity the updated content
 * @param path the rest url
 * @param verb the http method
 * @param prettyOutput output callback
 */
public void update(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restUpdate(path,entity);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48928
Project: 48928
Buggy source:
public TaskRead updateWithReturn(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restUpdate(path,entity);
      if (!validateAuthorization(response)) {
        return null;
      }
      return processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
public TaskRead updateWithReturn(Object entity,final String path,final HttpMethod verb,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restUpdate(path,entity);
      if (!validateAuthorization(response)) {
        return null;
      }
      return processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48929
Project: 48929
Buggy source:
/** 
 * process requests with query parameters
 * @param id
 * @param path the rest url
 * @param verb the http method
 * @param queryStrings required query strings
 * @param prettyOutput output callback
 */
public void actionOps(final String id,final String path,final HttpMethod verb,final Map<String,String> queryStrings,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restActionOps(path,id,queryStrings);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * process requests with query parameters
 * @param id
 * @param path the rest url
 * @param verb the http method
 * @param queryStrings required query strings
 * @param prettyOutput output callback
 */
public void actionOps(final String id,final String path,final HttpMethod verb,final Map<String,String> queryStrings,PrettyOutput... prettyOutput){
  checkConnection();
  try {
    if (verb == HttpMethod.PUT) {
      ResponseEntity<String> response=restActionOps(path,id,queryStrings);
      if (!validateAuthorization(response)) {
        return;
      }
      processResponse(response,HttpMethod.PUT,prettyOutput);
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}
Program: 48930
Project: 48930
Buggy source:
/** 
 * Generic method to get all objects of a type
 * @param entityType object type
 * @param path the rest url
 * @param verb the http method
 * @param detail flag to retrieve detailed information or not
 * @return the objects
 */
public <T>T getAllObjects(final Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGet(path,entityType,detail);
      if (!validateAuthorization(response)) {
        return null;
      }
      T objectsRead=response.getBody();
      return objectsRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(getExceptionMessage(e));
  }
}

Fixed version (ground truth):
/** 
 * Generic method to get all objects of a type
 * @param entityType object type
 * @param path the rest url
 * @param verb the http method
 * @param detail flag to retrieve detailed information or not
 * @return the objects
 */
public <T>T getAllObjects(final Class<T> entityType,final String path,final HttpMethod verb,final boolean detail){
  checkConnection();
  try {
    if (verb == HttpMethod.GET) {
      ResponseEntity<T> response=restGet(path,entityType,detail);
      if (!validateAuthorization(response)) {
        return null;
      }
      T objectsRead=response.getBody();
      return objectsRead;
    }
 else {
      throw new Exception(Constants.HTTP_VERB_ERROR);
    }
  }
 catch (  Exception e) {
    throw new CliRestException(CommandsUtils.getExceptionMessage(e));
  }
}