nus-yam/ex-repair huggingface dataset:
Program: 107284
Project: 107284
Buggy source:
public String getBootArgs(){
  String eth1Ip=(proxy.getPrivateIpAddress() == null) ? "String_Node_Str" : proxy.getPrivateIpAddress();
  String eth1NetMask=(proxy.getPrivateNetmask() == null) ? "String_Node_Str" : proxy.getPrivateNetmask();
  String eth2Ip=(proxy.getPublicIpAddress() == null) ? "String_Node_Str" : proxy.getPublicIpAddress();
  String eth2NetMask=(proxy.getPublicNetmask() == null) ? "String_Node_Str" : proxy.getPublicNetmask();
  String gateWay=(proxy.getGateway() == null) ? "String_Node_Str" : proxy.getGateway();
  String basic="String_Node_Str" + proxy.getGuestIpAddress() + "String_Node_Str"+ proxy.getGuestNetmask()+ "String_Node_Str"+ eth1Ip+ "String_Node_Str"+ eth1NetMask+ "String_Node_Str"+ eth2Ip+ "String_Node_Str"+ eth2NetMask+ "String_Node_Str"+ gateWay+ "String_Node_Str"+ proxy.getDns1()+ "String_Node_Str"+ "String_Node_Str"+ proxy.getHostName()+ "String_Node_Str";
  if (proxy.getDns2() != null) {
    basic=basic + "String_Node_Str" + proxy.getDns2();
  }
  basic=basic + "String_Node_Str" + mgmt_host+ "String_Node_Str"+ mgmt_port;
  if (sslEnabled)   basic=basic + "String_Node_Str";
  if (proxy.getPrivateIpAddress() == null || proxy.getPublicIpAddress() == null) {
    basic=basic + "String_Node_Str";
  }
  return basic;
}

Fixed version (ground truth):
public String getBootArgs(){
  String eth1Ip=(proxy.getPrivateIpAddress() == null) ? "String_Node_Str" : proxy.getPrivateIpAddress();
  String eth1NetMask=(proxy.getPrivateNetmask() == null) ? "String_Node_Str" : proxy.getPrivateNetmask();
  String eth2Ip=(proxy.getPublicIpAddress() == null) ? "String_Node_Str" : proxy.getPublicIpAddress();
  String eth2NetMask=(proxy.getPublicNetmask() == null) ? "String_Node_Str" : proxy.getPublicNetmask();
  String gateWay=(proxy.getGateway() == null) ? "String_Node_Str" : proxy.getGateway();
  String basic="String_Node_Str" + proxy.getGuestIpAddress() + "String_Node_Str"+ proxy.getGuestNetmask()+ "String_Node_Str"+ eth1Ip+ "String_Node_Str"+ eth1NetMask+ "String_Node_Str"+ eth2Ip+ "String_Node_Str"+ eth2NetMask+ "String_Node_Str"+ gateWay+ "String_Node_Str"+ proxy.getDns1()+ "String_Node_Str"+ "String_Node_Str"+ proxy.getName()+ "String_Node_Str";
  if (proxy.getDns2() != null) {
    basic=basic + "String_Node_Str" + proxy.getDns2();
  }
  basic=basic + "String_Node_Str" + mgmt_host+ "String_Node_Str"+ mgmt_port;
  if (sslEnabled)   basic=basic + "String_Node_Str";
  if (proxy.getPrivateIpAddress() == null || proxy.getPublicIpAddress() == null) {
    basic=basic + "String_Node_Str";
  }
  return basic;
}
Program: 107285
Project: 107285
Buggy source:
public String getBootArgs(){
  String eth2Ip=router.getPublicIpAddress() == null ? "String_Node_Str" : router.getPublicIpAddress();
  String basic="String_Node_Str" + router.getGuestIpAddress() + "String_Node_Str"+ router.getGuestNetmask()+ "String_Node_Str"+ router.getPrivateIpAddress()+ "String_Node_Str"+ router.getPrivateNetmask()+ "String_Node_Str"+ router.getGateway()+ "String_Node_Str"+ router.getDns1()+ "String_Node_Str"+ router.getHostName()+ "String_Node_Str"+ mgmt_host;
  if (!router.getPublicMacAddress().equalsIgnoreCase("String_Node_Str")) {
    basic=basic + "String_Node_Str" + eth2Ip+ "String_Node_Str"+ router.getPublicNetmask();
  }
  if (router.getDns2() != null) {
    basic=basic + "String_Node_Str" + router.getDns2();
  }
  if (getDhcpRange() != null) {
    basic=basic + "String_Node_Str" + getDhcpRange();
  }
  if (router.getRole() == Role.DHCP_FIREWALL_LB_PASSWD_USERDATA) {
    basic=basic + "String_Node_Str";
  }
 else   if (router.getRole() == Role.DHCP_USERDATA) {
    basic=basic + "String_Node_Str";
  }
  if (router.getDomain() != null) {
    basic+="String_Node_Str" + router.getDomain();
  }
  return basic;
}

Fixed version (ground truth):
public String getBootArgs(){
  String eth2Ip=router.getPublicIpAddress() == null ? "String_Node_Str" : router.getPublicIpAddress();
  String basic="String_Node_Str" + router.getGuestIpAddress() + "String_Node_Str"+ router.getGuestNetmask()+ "String_Node_Str"+ router.getPrivateIpAddress()+ "String_Node_Str"+ router.getPrivateNetmask()+ "String_Node_Str"+ router.getGateway()+ "String_Node_Str"+ router.getDns1()+ "String_Node_Str"+ router.getName()+ "String_Node_Str"+ mgmt_host;
  if (!router.getPublicMacAddress().equalsIgnoreCase("String_Node_Str")) {
    basic=basic + "String_Node_Str" + eth2Ip+ "String_Node_Str"+ router.getPublicNetmask();
  }
  if (router.getDns2() != null) {
    basic=basic + "String_Node_Str" + router.getDns2();
  }
  if (getDhcpRange() != null) {
    basic=basic + "String_Node_Str" + getDhcpRange();
  }
  if (router.getRole() == Role.DHCP_FIREWALL_LB_PASSWD_USERDATA) {
    basic=basic + "String_Node_Str";
  }
 else   if (router.getRole() == Role.DHCP_USERDATA) {
    basic=basic + "String_Node_Str";
  }
  if (router.getDomain() != null) {
    basic+="String_Node_Str" + router.getDomain();
  }
  return basic;
}
Program: 107290
Project: 107290
Buggy source:
@Override public FirewallRuleResponse createFirewallRuleResponse(PortForwardingRule fwRule){
  FirewallRuleResponse response=new FirewallRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(Integer.toString(fwRule.getDestinationPortStart()));
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(Integer.toString(fwRule.getSourcePortStart()));
  response.setPublicIpAddress(fwRule.getSourceIpAddress().toString());
  if (fwRule.getSourceIpAddress() != null && fwRule.getDestinationIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getHostName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  FirewallRule.State state=fwRule.getState();
  String stateToSet=state.toString();
  if (state.equals(FirewallRule.State.Revoke)) {
    stateToSet="String_Node_Str";
  }
  response.setState(stateToSet);
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public FirewallRuleResponse createFirewallRuleResponse(PortForwardingRule fwRule){
  FirewallRuleResponse response=new FirewallRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(Integer.toString(fwRule.getDestinationPortStart()));
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(Integer.toString(fwRule.getSourcePortStart()));
  response.setPublicIpAddress(fwRule.getSourceIpAddress().toString());
  if (fwRule.getSourceIpAddress() != null && fwRule.getDestinationIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  FirewallRule.State state=fwRule.getState();
  String stateToSet=state.toString();
  if (state.equals(FirewallRule.State.Revoke)) {
    stateToSet="String_Node_Str";
  }
  response.setState(stateToSet);
  response.setObjectName("String_Node_Str");
  return response;
}
Program: 107291
Project: 107291
Buggy source:
@Override public IpForwardingRuleResponse createIpForwardingRuleResponse(PortForwardingRule fwRule){
  IpForwardingRuleResponse response=new IpForwardingRuleResponse();
  response.setId(fwRule.getId());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicIpAddress(fwRule.getSourceIpAddress().addr());
  if (fwRule.getSourceIpAddress() != null && fwRule.getDestinationIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getHostName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  FirewallRule.State state=fwRule.getState();
  String stateToSet=state.toString();
  if (state.equals(FirewallRule.State.Revoke)) {
    stateToSet="String_Node_Str";
  }
  response.setState(stateToSet);
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public IpForwardingRuleResponse createIpForwardingRuleResponse(PortForwardingRule fwRule){
  IpForwardingRuleResponse response=new IpForwardingRuleResponse();
  response.setId(fwRule.getId());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicIpAddress(fwRule.getSourceIpAddress().addr());
  if (fwRule.getSourceIpAddress() != null && fwRule.getDestinationIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  FirewallRule.State state=fwRule.getState();
  String stateToSet=state.toString();
  if (state.equals(FirewallRule.State.Revoke)) {
    stateToSet="String_Node_Str";
  }
  response.setState(stateToSet);
  response.setObjectName("String_Node_Str");
  return response;
}
Program: 107293
Project: 107293
Buggy source:
public static ConsoleProxyOperationResultObject composeResultObject(ManagementServer managementServer,ConsoleProxyVO proxy){
  ConsoleProxyOperationResultObject result=new ConsoleProxyOperationResultObject();
  result.setId(proxy.getId());
  result.setName(proxy.getHostName());
  result.setZoneId(proxy.getDataCenterId());
  result.setZoneName(managementServer.findDataCenterById(proxy.getDataCenterId()).getName());
  result.setDns1(proxy.getDns1());
  result.setDns2(proxy.getDns2());
  result.setNetworkDomain(proxy.getDomain());
  result.setGateway(proxy.getGateway());
  result.setPodId(proxy.getPodId());
  result.setHostId(proxy.getHostId());
  if (proxy.getHostId() != null)   result.setHostName(managementServer.getHostBy(proxy.getHostId()).getName());
  result.setPrivateIp(proxy.getPrivateIpAddress());
  result.setPrivateMac(proxy.getPrivateMacAddress());
  result.setPrivateNetmask(proxy.getPrivateNetmask());
  result.setPublicIp(proxy.getPublicIpAddress());
  result.setPublicMac(proxy.getPublicMacAddress());
  result.setPublicNetmask(proxy.getPublicNetmask());
  result.setTemplateId(proxy.getTemplateId());
  result.setCreated(proxy.getCreated());
  result.setActionSessions(proxy.getActiveSession());
  result.setState(proxy.getState().toString());
  return result;
}

Fixed version (ground truth):
public static ConsoleProxyOperationResultObject composeResultObject(ManagementServer managementServer,ConsoleProxyVO proxy){
  ConsoleProxyOperationResultObject result=new ConsoleProxyOperationResultObject();
  result.setId(proxy.getId());
  result.setName(proxy.getName());
  result.setZoneId(proxy.getDataCenterId());
  result.setZoneName(managementServer.findDataCenterById(proxy.getDataCenterId()).getName());
  result.setDns1(proxy.getDns1());
  result.setDns2(proxy.getDns2());
  result.setNetworkDomain(proxy.getDomain());
  result.setGateway(proxy.getGateway());
  result.setPodId(proxy.getPodId());
  result.setHostId(proxy.getHostId());
  if (proxy.getHostId() != null)   result.setHostName(managementServer.getHostBy(proxy.getHostId()).getName());
  result.setPrivateIp(proxy.getPrivateIpAddress());
  result.setPrivateMac(proxy.getPrivateMacAddress());
  result.setPrivateNetmask(proxy.getPrivateNetmask());
  result.setPublicIp(proxy.getPublicIpAddress());
  result.setPublicMac(proxy.getPublicMacAddress());
  result.setPublicNetmask(proxy.getPublicNetmask());
  result.setTemplateId(proxy.getTemplateId());
  result.setCreated(proxy.getCreated());
  result.setActionSessions(proxy.getActiveSession());
  result.setState(proxy.getState().toString());
  return result;
}
Program: 107295
Project: 107295
Buggy source:
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_DESTROY);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getHostName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getHostName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  boolean jobStatusUpdated=false;
  try {
    asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    jobStatusUpdated=true;
    asyncMgr.getExecutorContext().getEventDao().persist(event);
  }
 catch (  Exception e) {
    if (!jobStatusUpdated)     asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    asyncMgr.releaseSyncSource(this);
  }
}

Fixed version (ground truth):
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_DESTROY);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  boolean jobStatusUpdated=false;
  try {
    asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    jobStatusUpdated=true;
    asyncMgr.getExecutorContext().getEventDao().persist(event);
  }
 catch (  Exception e) {
    if (!jobStatusUpdated)     asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
 finally {
    asyncMgr.releaseSyncSource(this);
  }
}
Program: 107297
Project: 107297
Buggy source:
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_REBOOT);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getHostName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getHostName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  boolean jobStatusUpdated=false;
  try {
    asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    jobStatusUpdated=true;
    asyncMgr.getExecutorContext().getEventDao().persist(event);
  }
 catch (  Exception e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
    if (!jobStatusUpdated)     asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
  }
 finally {
    asyncMgr.releaseSyncSource(this);
  }
}

Fixed version (ground truth):
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_REBOOT);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  boolean jobStatusUpdated=false;
  try {
    asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
    jobStatusUpdated=true;
    asyncMgr.getExecutorContext().getEventDao().persist(event);
  }
 catch (  Exception e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
    if (!jobStatusUpdated)     asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
  }
 finally {
    asyncMgr.releaseSyncSource(this);
  }
}
Program: 107300
Project: 107300
Buggy source:
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_STOP);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getHostName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getHostName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
  asyncMgr.getExecutorContext().getEventDao().persist(event);
  asyncMgr.releaseSyncSource(this);
}

Fixed version (ground truth):
private void processDisconnectAndTimeout(VMOperationListener listener,String resultMessage){
  UserVmVO vm=listener.getVm();
  VMOperationParam param=listener.getParam();
  AsyncJobManager asyncMgr=getAsyncJobMgr();
  EventVO event=new EventVO();
  event.setUserId(param.getUserId());
  event.setAccountId(vm.getAccountId());
  event.setType(EventTypes.EVENT_VM_STOP);
  event.setParameters("String_Node_Str" + vm.getId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ vm.getServiceOfferingId()+ "String_Node_Str"+ vm.getTemplateId()+ "String_Node_Str"+ vm.getDataCenterId());
  event.setDescription("String_Node_Str" + vm.getName() + "String_Node_Str"+ resultMessage);
  event.setLevel(EventVO.LEVEL_ERROR);
  asyncMgr.completeAsyncJob(getJob().getId(),AsyncJobResult.STATUS_FAILED,0,resultMessage);
  asyncMgr.getExecutorContext().getEventDao().persist(event);
  asyncMgr.releaseSyncSource(this);
}
Program: 107302
Project: 107302
Buggy source:
private Object composeResultObject(ManagementServer managementServer,VMInstanceVO vm){
  SystemVmOperationResultObject result=new SystemVmOperationResultObject();
  if (vm instanceof SecondaryStorageVmVO) {
    SecondaryStorageVmVO ssVm=(SecondaryStorageVmVO)vm;
    result.setId(ssVm.getId());
    result.setName(vm.getHostName());
    result.setZoneId(ssVm.getDataCenterId());
    result.setZoneName(managementServer.findDataCenterById(ssVm.getDataCenterId()).getName());
    result.setDns1(ssVm.getDns1());
    result.setDns2(ssVm.getDns2());
    result.setNetworkDomain(ssVm.getDomain());
    result.setGateway(ssVm.getGateway());
    result.setPodId(ssVm.getPodId());
    result.setHostId(ssVm.getHostId());
    if (ssVm.getHostId() != null)     result.setHostName(managementServer.getHostBy(ssVm.getHostId()).getName());
    result.setPrivateIp(ssVm.getPrivateIpAddress());
    result.setPrivateMac(ssVm.getPrivateMacAddress());
    result.setPrivateNetmask(ssVm.getPrivateNetmask());
    result.setPublicIp(ssVm.getPublicIpAddress());
    result.setPublicMac(ssVm.getPublicMacAddress());
    result.setPublicNetmask(ssVm.getPublicNetmask());
    result.setTemplateId(ssVm.getTemplateId());
    result.setCreated(ssVm.getCreated());
    result.setState(ssVm.getState().toString());
  }
  return result;
}

Fixed version (ground truth):
private Object composeResultObject(ManagementServer managementServer,VMInstanceVO vm){
  SystemVmOperationResultObject result=new SystemVmOperationResultObject();
  if (vm instanceof SecondaryStorageVmVO) {
    SecondaryStorageVmVO ssVm=(SecondaryStorageVmVO)vm;
    result.setId(ssVm.getId());
    result.setName(vm.getName());
    result.setZoneId(ssVm.getDataCenterId());
    result.setZoneName(managementServer.findDataCenterById(ssVm.getDataCenterId()).getName());
    result.setDns1(ssVm.getDns1());
    result.setDns2(ssVm.getDns2());
    result.setNetworkDomain(ssVm.getDomain());
    result.setGateway(ssVm.getGateway());
    result.setPodId(ssVm.getPodId());
    result.setHostId(ssVm.getHostId());
    if (ssVm.getHostId() != null)     result.setHostName(managementServer.getHostBy(ssVm.getHostId()).getName());
    result.setPrivateIp(ssVm.getPrivateIpAddress());
    result.setPrivateMac(ssVm.getPrivateMacAddress());
    result.setPrivateNetmask(ssVm.getPrivateNetmask());
    result.setPublicIp(ssVm.getPublicIpAddress());
    result.setPublicMac(ssVm.getPublicMacAddress());
    result.setPublicNetmask(ssVm.getPublicNetmask());
    result.setTemplateId(ssVm.getTemplateId());
    result.setCreated(ssVm.getCreated());
    result.setState(ssVm.getState().toString());
  }
  return result;
}
Program: 107304
Project: 107304
Buggy source:
private AttachVolumeOperationResultObject composeAttachResultObject(UserVm instance,VolumeVO vol){
  AttachVolumeOperationResultObject resultObject=new AttachVolumeOperationResultObject();
  resultObject.setVmName(instance.getHostName());
  resultObject.setVmDisplayName(instance.getDisplayName());
  resultObject.setVirtualMachineId(instance.getId());
  resultObject.setVmState(instance.getState().toString());
  resultObject.setStorageType("String_Node_Str");
  resultObject.setVolumeId(vol.getId());
  resultObject.setVolumeName(vol.getName());
  return resultObject;
}

Fixed version (ground truth):
private AttachVolumeOperationResultObject composeAttachResultObject(UserVm instance,VolumeVO vol){
  AttachVolumeOperationResultObject resultObject=new AttachVolumeOperationResultObject();
  resultObject.setVmName(instance.getName());
  resultObject.setVmDisplayName(instance.getDisplayName());
  resultObject.setVirtualMachineId(instance.getId());
  resultObject.setVmState(instance.getState().toString());
  resultObject.setStorageType("String_Node_Str");
  resultObject.setVolumeId(vol.getId());
  resultObject.setVolumeName(vol.getName());
  return resultObject;
}
Program: 107305
Project: 107305
Buggy source:
public int getVncPort(VMInstanceVO vm){
  if (vm.getHostId() == null) {
    return -1;
  }
  GetVncPortAnswer answer=(GetVncPortAnswer)_agentMgr.easySend(vm.getHostId(),new GetVncPortCommand(vm.getId(),vm.getHostName()));
  return answer == null ? -1 : answer.getPort();
}

Fixed version (ground truth):
public int getVncPort(VMInstanceVO vm){
  if (vm.getHostId() == null) {
    return -1;
  }
  GetVncPortAnswer answer=(GetVncPortAnswer)_agentMgr.easySend(vm.getHostId(),new GetVncPortCommand(vm.getId(),vm.getName()));
  return answer == null ? -1 : answer.getPort();
}
Program: 107307
Project: 107307
Buggy source:
protected VBD createVbd(Connection conn,VolumeTO volume,String vmName,VM vm) throws XmlRpcException, XenAPIException {
  VolumeType type=volume.getType();
  VDI vdi=mount(conn,vmName,volume);
  VBD.Record vbdr=new VBD.Record();
  vbdr.VM=vm;
  if (vdi != null)   vbdr.VDI=vdi;
 else {
    vbdr.empty=true;
  }
  if (type == VolumeType.ROOT) {
    vbdr.bootable=true;
  }
  vbdr.userdevice=Long.toString(volume.getDeviceId());
  if (volume.getType() == VolumeType.ISO) {
    vbdr.mode=Types.VbdMode.RO;
    vbdr.type=Types.VbdType.CD;
  }
 else {
    vbdr.mode=Types.VbdMode.RW;
    vbdr.type=Types.VbdType.DISK;
  }
  VBD vbd=VBD.create(conn,vbdr);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vbd.getUuid(conn) + "String_Node_Str"+ volume);
  }
  return vbd;
}

Fixed version (ground truth):
protected VBD createVbd(Connection conn,VolumeTO volume,String vmName,VM vm,BootloaderType bootLoaderType) throws XmlRpcException, XenAPIException {
  VolumeType type=volume.getType();
  VDI vdi=mount(conn,vmName,volume);
  VBD.Record vbdr=new VBD.Record();
  vbdr.VM=vm;
  if (vdi != null)   vbdr.VDI=vdi;
 else {
    vbdr.empty=true;
  }
  if (type == VolumeType.ROOT && bootLoaderType == BootloaderType.PyGrub) {
    vbdr.bootable=true;
  }
 else   if (type == VolumeType.ISO && bootLoaderType == BootloaderType.CD) {
    vbdr.bootable=true;
  }
  vbdr.userdevice=Long.toString(volume.getDeviceId());
  if (volume.getType() == VolumeType.ISO) {
    vbdr.mode=Types.VbdMode.RO;
    vbdr.type=Types.VbdType.CD;
  }
 else {
    vbdr.mode=Types.VbdMode.RW;
    vbdr.type=Types.VbdType.DISK;
  }
  VBD vbd=VBD.create(conn,vbdr);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vbd.getUuid(conn) + "String_Node_Str"+ volume);
  }
  return vbd;
}
Program: 107311
Project: 107311
Buggy source:
@Override public boolean finalizeDeployment(Commands cmds,VirtualMachineProfile<DomainRouterVO> profile,DeployDestination dest,ReservationContext context){
  NicProfile controlNic=(NicProfile)profile.getParameter("String_Node_Str");
  cmds.addCommand("String_Node_Str",new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20));
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeDeployment(Commands cmds,VirtualMachineProfile<DomainRouterVO> profile,DeployDestination dest,ReservationContext context){
  NicProfile controlNic=(NicProfile)profile.getParameter("String_Node_Str");
  cmds.addCommand("String_Node_Str",new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20));
  DomainRouterVO router=profile.getVirtualMachine();
  List<NicVO> nics=_nicDao.listBy(router.getId());
  for (  NicVO nic : nics) {
    NetworkVO network=_networkDao.findById(nic.getNetworkId());
    if (network.getTrafficType() == TrafficType.Public) {
      router.setPublicIpAddress(nic.getIp4Address());
      router.setPublicNetmask(nic.getNetmask());
      router.setPublicMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Guest) {
      router.setGuestIpAddress(nic.getIp4Address());
      router.setGuestMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Control) {
      router.setPrivateIpAddress(nic.getIp4Address());
      router.setPrivateNetmask(nic.getNetmask());
      router.setPrivateMacAddress(nic.getMacAddress());
    }
  }
  final List<IPAddressVO> ipAddrs=_networkMgr.listPublicIpAddressesInVirtualNetwork(router.getAccountId(),router.getDataCenterId(),null);
  final List<String> ipAddrList=new ArrayList<String>();
  for (  final IPAddressVO ipVO : ipAddrs) {
    ipAddrList.add(ipVO.getAddress());
  }
  if (!ipAddrList.isEmpty()) {
    _networkMgr.getAssociateIPCommands(router,ipAddrList,true,0,cmds);
  }
  return true;
}
Program: 107312
Project: 107312
Buggy source:
@Override public boolean finalizeStart(Commands cmds,VirtualMachineProfile<DomainRouterVO> profile,DeployDestination dest,ReservationContext context){
  CheckSshAnswer answer=(CheckSshAnswer)cmds.getAnswer("String_Node_Str");
  if (!answer.getResult()) {
    s_logger.warn("String_Node_Str" + answer.getDetails());
    return false;
  }
  DomainRouterVO router=profile.getVirtualMachine();
  List<NicVO> nics=_nicDao.listBy(router.getId());
  for (  NicVO nic : nics) {
    NetworkVO network=_networkDao.findById(nic.getNetworkId());
    if (network.getTrafficType() == TrafficType.Public) {
      router.setPublicIpAddress(nic.getIp4Address());
      router.setPublicNetmask(nic.getNetmask());
      router.setPublicMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Guest) {
      router.setGuestIpAddress(nic.getIp4Address());
      router.setGuestMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Control) {
      router.setPrivateIpAddress(nic.getIp4Address());
      router.setPrivateNetmask(nic.getNetmask());
      router.setPrivateMacAddress(nic.getMacAddress());
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeStart(Commands cmds,VirtualMachineProfile<DomainRouterVO> profile,DeployDestination dest,ReservationContext context){
  CheckSshAnswer answer=(CheckSshAnswer)cmds.getAnswer("String_Node_Str");
  if (!answer.getResult()) {
    s_logger.warn("String_Node_Str" + answer.getDetails());
    return false;
  }
  return true;
}
Program: 107313
Project: 107313
Buggy source:
public VolumeTO(Volume volume,StoragePool pool){
  this.id=volume.getId();
  this.name=volume.getName();
  this.path=volume.getPath();
  this.size=volume.getSize();
  this.type=volume.getVolumeType();
  this.resourceType=volume.getStorageResourceType();
  this.storagePoolType=pool.getPoolType();
  this.storagePoolUuid=pool.getUuid();
  this.mountPoint=volume.getFolder();
  this.chainInfo=volume.getChainInfo();
}

Fixed version (ground truth):
public VolumeTO(Volume volume,StoragePool pool){
  this.id=volume.getId();
  this.name=volume.getName();
  this.path=volume.getPath();
  this.size=volume.getSize();
  this.type=volume.getVolumeType();
  this.resourceType=volume.getStorageResourceType();
  this.storagePoolType=pool.getPoolType();
  this.storagePoolUuid=pool.getUuid();
  this.mountPoint=volume.getFolder();
  this.chainInfo=volume.getChainInfo();
  this.deviceId=volume.getDeviceId().intValue();
}
Program: 107314
Project: 107314
Buggy source:
public String getHypervisor(){
  return hypervisor;
}

Fixed version (ground truth):
public HypervisorType getHypervisor(){
  return HypervisorType.getType(hypervisor);
}
Program: 107315
Project: 107315
Buggy source:
protected VBD createVbd(Connection conn,VolumeTO volume,String vmName,VM vm) throws XmlRpcException, XenAPIException {
  VolumeType type=volume.getType();
  VDI vdi=mount(conn,vmName,volume);
  VBD.Record vbdr=new VBD.Record();
  vbdr.VM=vm;
  vbdr.VDI=vdi;
  if (type == VolumeType.ROOT) {
    vbdr.bootable=true;
  }
  vbdr.userdevice=Long.toString(volume.getDeviceId());
  if (volume.getType() == VolumeType.ISO) {
    vbdr.mode=Types.VbdMode.RO;
    vbdr.type=Types.VbdType.CD;
  }
 else {
    vbdr.mode=Types.VbdMode.RW;
    vbdr.type=Types.VbdType.DISK;
  }
  VBD vbd=VBD.create(conn,vbdr);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vbd.getUuid(conn) + "String_Node_Str"+ volume);
  }
  return vbd;
}

Fixed version (ground truth):
protected VBD createVbd(Connection conn,VolumeTO volume,String vmName,VM vm) throws XmlRpcException, XenAPIException {
  VolumeType type=volume.getType();
  VDI vdi=mount(conn,vmName,volume);
  VBD.Record vbdr=new VBD.Record();
  vbdr.VM=vm;
  if (vdi != null)   vbdr.VDI=vdi;
 else {
    vbdr.empty=true;
  }
  if (type == VolumeType.ROOT) {
    vbdr.bootable=true;
  }
  vbdr.userdevice=Long.toString(volume.getDeviceId());
  if (volume.getType() == VolumeType.ISO) {
    vbdr.mode=Types.VbdMode.RO;
    vbdr.type=Types.VbdType.CD;
  }
 else {
    vbdr.mode=Types.VbdMode.RW;
    vbdr.type=Types.VbdType.DISK;
  }
  VBD vbd=VBD.create(conn,vbdr);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vbd.getUuid(conn) + "String_Node_Str"+ volume);
  }
  return vbd;
}
Program: 107317
Project: 107317
Buggy source:
public ConsoleProxyVO start2(long proxyVmId,long startEventId) throws ResourceUnavailableException, InsufficientCapacityException {
  if (!_useNewNetworking) {
    return start(proxyVmId,startEventId);
  }
  ConsoleProxyVO proxy=_consoleProxyDao.findById(proxyVmId);
  Account systemAcct=_accountMgr.getSystemAccount();
  User systemUser=_accountMgr.getSystemUser();
  return _itMgr.start(proxy,null,systemUser,systemAcct);
}

Fixed version (ground truth):
public ConsoleProxyVO start2(long proxyVmId,long startEventId) throws ResourceUnavailableException, InsufficientCapacityException {
  if (!_useNewNetworking) {
    return start(proxyVmId,startEventId);
  }
  ConsoleProxyVO proxy=_consoleProxyDao.findById(proxyVmId);
  Account systemAcct=_accountMgr.getSystemAccount();
  User systemUser=_accountMgr.getSystemUser();
  return _itMgr.start(proxy,null,systemUser,systemAcct,null);
}
Program: 107318
Project: 107318
Buggy source:
@Override public <T extends VirtualMachine>VirtualMachineTO implement(VirtualMachineProfile<T> vm){
  VirtualMachineTemplate template=vm.getTemplate();
  BootloaderType bt=BootloaderType.PyGrub;
  if (template.getFormat() == Storage.ImageFormat.ISO || template.isRequiresHvm()) {
    bt=BootloaderType.HVM;
  }
  VirtualMachineTO to=toVirtualMachineTO(vm);
  to.setBootloader(bt);
  GuestOSVO guestOS=_guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
  to.setOs(guestOS.getDisplayName());
  return to;
}

Fixed version (ground truth):
@Override public <T extends VirtualMachine>VirtualMachineTO implement(VirtualMachineProfile<T> vm){
  BootloaderType bt=BootloaderType.PyGrub;
  if (vm.getBootLoaderType() != null) {
    bt=vm.getBootLoaderType();
  }
  VirtualMachineTO to=toVirtualMachineTO(vm);
  to.setBootloader(bt);
  GuestOSVO guestOS=_guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
  to.setOs(guestOS.getDisplayName());
  return to;
}
Program: 107319
Project: 107319
Buggy source:
public DomainRouterVO start(DomainRouterVO router,User user,Account caller) throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
  return _itMgr.start(router,null,user,caller);
}

Fixed version (ground truth):
public DomainRouterVO start(DomainRouterVO router,User user,Account caller) throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
  return _itMgr.start(router,null,user,caller,null);
}
Program: 107322
Project: 107322
Buggy source:
public SecondaryStorageVmVO start2(long secStorageVmId,long startEventId) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException {
  if (!_useNewNetworking) {
    return start(secStorageVmId,startEventId);
  }
  SecondaryStorageVmVO secStorageVm=_secStorageVmDao.findById(secStorageVmId);
  Account systemAcct=_accountMgr.getSystemAccount();
  User systemUser=_accountMgr.getSystemUser();
  return _itMgr.start(secStorageVm,null,systemUser,systemAcct);
}

Fixed version (ground truth):
public SecondaryStorageVmVO start2(long secStorageVmId,long startEventId) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException {
  if (!_useNewNetworking) {
    return start(secStorageVmId,startEventId);
  }
  SecondaryStorageVmVO secStorageVm=_secStorageVmDao.findById(secStorageVmId);
  Account systemAcct=_accountMgr.getSystemAccount();
  User systemUser=_accountMgr.getSystemUser();
  return _itMgr.start(secStorageVm,null,systemUser,systemAcct,null);
}
Program: 107324
Project: 107324
Buggy source:
@Override public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> profile,DeployDestination dest,ReservationContext context){
  UserVmVO vo=profile.getVirtualMachine();
  VirtualMachineTemplate template=profile.getTemplate();
  if (template.getFormat() == ImageFormat.ISO && template.isBootable()) {
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> profile,DeployDestination dest,ReservationContext context){
  UserVmVO vo=profile.getVirtualMachine();
  VirtualMachineTemplate template=profile.getTemplate();
  if (vo.getIsoId() != null) {
    template=_templateDao.findById(vo.getIsoId());
  }
  if (template != null && template.getFormat() == ImageFormat.ISO && template.isBootable()) {
    String isoPath=null;
    Pair<String,String> isoPathPair=_storageMgr.getAbsoluteIsoPath(template.getId(),vo.getDataCenterId());
    if (isoPathPair == null) {
      s_logger.warn("String_Node_Str");
      return false;
    }
 else {
      isoPath=isoPathPair.first();
    }
    profile.setBootLoaderType(BootloaderType.CD);
    VolumeTO iso=new VolumeTO(profile.getId(),Volume.VolumeType.ISO,StorageResourceType.STORAGE_POOL,StoragePoolType.ISO,null,template.getName(),null,isoPath,0,null);
    iso.setDeviceId(3);
    profile.addDisk(iso);
    vo.setIsoId(template.getId());
  }
 else {
    VolumeTO iso=new VolumeTO(profile.getId(),Volume.VolumeType.ISO,StorageResourceType.STORAGE_POOL,StoragePoolType.ISO,null,template.getName(),null,null,0,null);
    iso.setDeviceId(3);
    profile.addDisk(iso);
  }
  return true;
}
Program: 107325
Project: 107325
Buggy source:
@Override public UserVm startVirtualMachine(long vmId) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  Account account=UserContext.current().getAccount();
  Long userId=UserContext.current().getUserId();
  if (account != null && account.getRemoved() != null) {
    throw new PermissionDeniedException("String_Node_Str" + account.getId() + "String_Node_Str");
  }
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + vmId);
  }
  long eventId=EventUtils.saveScheduledEvent(userId,vm.getAccountId(),EventTypes.EVENT_VM_START,"String_Node_Str" + vmId);
  userId=accountAndUserValidation(vmId,account,userId,vm);
  UserVO user=_userDao.findById(userId);
  return _itMgr.start(vm,null,user,account);
}

Fixed version (ground truth):
@Override public UserVm startVirtualMachine(long vmId) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  Account account=UserContext.current().getAccount();
  Long userId=UserContext.current().getUserId();
  if (account != null && account.getRemoved() != null) {
    throw new PermissionDeniedException("String_Node_Str" + account.getId() + "String_Node_Str");
  }
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + vmId);
  }
  long eventId=EventUtils.saveScheduledEvent(userId,vm.getAccountId(),EventTypes.EVENT_VM_START,"String_Node_Str" + vmId);
  userId=accountAndUserValidation(vmId,account,userId,vm);
  UserVO user=_userDao.findById(userId);
  VolumeVO disk=_volsDao.findByInstance(vmId).get(0);
  HypervisorType hyperType=_volsDao.getHypervisorType(disk.getId());
  return _itMgr.start(vm,null,user,account,hyperType);
}
Program: 107326
Project: 107326
Buggy source:
<T extends VMInstanceVO>T allocate(T vm,VMTemplateVO template,ServiceOfferingVO serviceOffering,List<Pair<NetworkVO,NicProfile>> networkProfiles,DeploymentPlan plan,Account owner) throws InsufficientCapacityException, ResourceUnavailableException ;

Fixed version (ground truth):
<T extends VMInstanceVO>T allocate(T vm,VMTemplateVO template,ServiceOfferingVO serviceOffering,List<Pair<NetworkVO,NicProfile>> networkProfiles,DeploymentPlan plan,HypervisorType hyperType,Account owner) throws InsufficientCapacityException, ResourceUnavailableException ;
Program: 107327
Project: 107327
Buggy source:
<T extends VMInstanceVO>T start(T vm,Map<String,Object> params,User caller,Account account) throws InsufficientCapacityException, ResourceUnavailableException ;

Fixed version (ground truth):
<T extends VMInstanceVO>T start(T vm,Map<String,Object> params,User caller,Account account,HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException ;
Program: 107328
Project: 107328
Buggy source:
<T extends VMInstanceVO>T advanceStart(T vm,Map<String,Object> params,User caller,Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException ;

Fixed version (ground truth):
<T extends VMInstanceVO>T advanceStart(T vm,Map<String,Object> params,User caller,Account account,HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException ;
Program: 107329
Project: 107329
Buggy source:
@Override public <T extends VMInstanceVO>T start(T vm,Map<String,Object> params,User caller,Account account) throws InsufficientCapacityException, ResourceUnavailableException {
  try {
    return advanceStart(vm,params,caller,account);
  }
 catch (  ConcurrentOperationException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public <T extends VMInstanceVO>T start(T vm,Map<String,Object> params,User caller,Account account,HypervisorType hyperType) throws InsufficientCapacityException, ResourceUnavailableException {
  try {
    return advanceStart(vm,params,caller,account,hyperType);
  }
 catch (  ConcurrentOperationException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}
Program: 107330
Project: 107330
Buggy source:
@Override public <T extends VMInstanceVO>T allocate(T vm,VMTemplateVO template,ServiceOfferingVO serviceOffering,List<Pair<NetworkVO,NicProfile>> networks,DeploymentPlan plan,Account owner) throws InsufficientCapacityException {
  return allocate(vm,template,serviceOffering,new Pair<DiskOfferingVO,Long>(serviceOffering,null),null,networks,null,plan,owner);
}

Fixed version (ground truth):
@Override public <T extends VMInstanceVO>T allocate(T vm,VMTemplateVO template,ServiceOfferingVO serviceOffering,List<Pair<NetworkVO,NicProfile>> networks,DeploymentPlan plan,HypervisorType hyperType,Account owner) throws InsufficientCapacityException {
  return allocate(vm,template,serviceOffering,new Pair<DiskOfferingVO,Long>(serviceOffering,null),null,networks,null,plan,hyperType,owner);
}
Program: 107332
Project: 107332
Buggy source:
@SuppressWarnings("String_Node_Str") private <T extends VMInstanceVO>VirtualMachineGuru<T> getVmGuru(T vm){
  return (VirtualMachineGuru<T>)_vmGurus.get(vm);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T extends VMInstanceVO>VirtualMachineGuru<T> getVmGuru(T vm){
  return (VirtualMachineGuru<T>)_vmGurus.get(vm.getType());
}
Program: 107333
Project: 107333
Buggy source:
public void update(Long id,String domainName);

Fixed version (ground truth):
public void update(Long id,String domainName,String domainPath);
Program: 107334
Project: 107334
Buggy source:
public void update(Long id,String domainName){
  DomainVO ub=createForUpdate();
  ub.setName(domainName);
  update(id,ub);
}

Fixed version (ground truth):
public void update(Long id,String domainName,String domainPath){
  DomainVO ub=createForUpdate();
  ub.setName(domainName);
  ub.setPath(domainPath);
  update(id,ub);
}
Program: 107337
Project: 107337
Buggy source:
@Override public void execute(){
  Volume result=_userVmService.attachVolumeToVM(this);
  if (result != null) {
    VolumeResponse response=_responseGenerator.createVolumeResponse(result);
    response.setResponseName(getName());
    this.setResponseObject(response);
  }
 else {
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void execute(){
  try {
    Thread.sleep(2000);
  }
 catch (  Exception e) {
  }
  Volume result=_userVmService.attachVolumeToVM(this);
  if (result != null) {
    VolumeResponse response=_responseGenerator.createVolumeResponse(result);
    response.setResponseName(getName());
    this.setResponseObject(response);
  }
 else {
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
  }
}
Program: 107338
Project: 107338
Buggy source:
@Override public IpForwardingRuleResponse createIpForwardingRuleResponse(FirewallRule fwRule){
  IpForwardingRuleResponse response=new IpForwardingRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(fwRule.getPrivatePort());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(fwRule.getPublicPort());
  response.setPublicIpAddress(fwRule.getPublicIpAddress());
  if (fwRule.getPublicIpAddress() != null && fwRule.getPrivateIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmByPublicIpAndGuestIp(fwRule.getPublicIpAddress(),fwRule.getPrivateIpAddress());
    response.setVirtualMachineId(vm.getId());
    response.setVirtualMachineName(vm.getHostName());
    response.setVirtualMachineDisplayName(vm.getDisplayName());
  }
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public IpForwardingRuleResponse createIpForwardingRuleResponse(FirewallRule fwRule){
  IpForwardingRuleResponse response=new IpForwardingRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(fwRule.getPrivatePort());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(fwRule.getPublicPort());
  response.setPublicIpAddress(fwRule.getPublicIpAddress());
  if (fwRule.getPublicIpAddress() != null && fwRule.getPrivateIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmByPublicIpAndGuestIp(fwRule.getPublicIpAddress(),fwRule.getPrivateIpAddress());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getHostName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  response.setObjectName("String_Node_Str");
  return response;
}
Program: 107339
Project: 107339
Buggy source:
@Override public FirewallRuleResponse createFirewallRuleResponse(FirewallRule fwRule){
  FirewallRuleResponse response=new FirewallRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(fwRule.getPrivatePort());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(fwRule.getPublicPort());
  response.setPublicIpAddress(fwRule.getPublicIpAddress());
  if (fwRule.getPublicIpAddress() != null && fwRule.getPrivateIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmByPublicIpAndGuestIp(fwRule.getPublicIpAddress(),fwRule.getPrivateIpAddress());
    response.setVirtualMachineId(vm.getId());
    response.setVirtualMachineName(vm.getHostName());
    response.setVirtualMachineDisplayName(vm.getDisplayName());
  }
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public FirewallRuleResponse createFirewallRuleResponse(FirewallRule fwRule){
  FirewallRuleResponse response=new FirewallRuleResponse();
  response.setId(fwRule.getId());
  response.setPrivatePort(fwRule.getPrivatePort());
  response.setProtocol(fwRule.getProtocol());
  response.setPublicPort(fwRule.getPublicPort());
  response.setPublicIpAddress(fwRule.getPublicIpAddress());
  if (fwRule.getPublicIpAddress() != null && fwRule.getPrivateIpAddress() != null) {
    UserVm vm=ApiDBUtils.findUserVmByPublicIpAndGuestIp(fwRule.getPublicIpAddress(),fwRule.getPrivateIpAddress());
    if (vm != null) {
      response.setVirtualMachineId(vm.getId());
      response.setVirtualMachineName(vm.getHostName());
      response.setVirtualMachineDisplayName(vm.getDisplayName());
    }
  }
  response.setObjectName("String_Node_Str");
  return response;
}