nus-yam/ex-repair huggingface dataset:
Program: 89906
Project: 89906
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: 89907
Project: 89907
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: 89912
Project: 89912
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: 89913
Project: 89913
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: 89915
Project: 89915
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: 89917
Project: 89917
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: 89919
Project: 89919
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: 89922
Project: 89922
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: 89924
Project: 89924
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: 89926
Project: 89926
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: 89927
Project: 89927
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: 89929
Project: 89929
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: 89930
Project: 89930
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: 89931
Project: 89931
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: 89935
Project: 89935
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: 89936
Project: 89936
Buggy source:
public String getHypervisor(){
  return hypervisor;
}

Fixed version (ground truth):
public HypervisorType getHypervisor(){
  return HypervisorType.getType(hypervisor);
}
Program: 89937
Project: 89937
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: 89939
Project: 89939
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: 89940
Project: 89940
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: 89941
Project: 89941
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: 89944
Project: 89944
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: 89945
Project: 89945
Buggy source:
/** 
 * Create an IconDrawable.
 * @param context Your activity or application context.
 * @param icon    The icon you want this drawable to display.
 */
public IconDrawable(Context context,Iconify.IconValue icon){
  this.context=context;
  this.icon=icon;
  paint=new TextPaint();
  paint.setTypeface(Iconify.getTypeface(context));
  paint.setStyle(Paint.Style.STROKE);
  paint.setTextAlign(Paint.Align.CENTER);
  paint.setUnderlineText(false);
  paint.setColor(Color.BLACK);
  paint.setAntiAlias(true);
}

Fixed version (ground truth):
/** 
 * Create an IconDrawable.
 * @param context Your activity or application context.
 * @param icon    The icon you want this drawable to display.
 */
public IconDrawable(Context context,Iconify.IconValue icon){
  this.context=context;
  this.icon=icon;
  paint=new TextPaint();
  paint.setTypeface(Iconify.getTypeface(context));
  paint.setStyle(Paint.Style.FILL);
  paint.setTextAlign(Paint.Align.CENTER);
  paint.setUnderlineText(false);
  paint.setColor(Color.BLACK);
  paint.setAntiAlias(true);
}
Program: 89946
Project: 89946
Buggy source:
private void init(){
  Iconify.addIcons(this);
}

Fixed version (ground truth):
private void init(){
  if (!isInEditMode())   Iconify.addIcons(this);
 else   this.setText(this.getText());
}
Program: 89947
Project: 89947
Buggy source:
private void init(){
  if (!isInEditMode())   Iconify.addIcons(this);
 else   this.setText("String_Node_Str");
}

Fixed version (ground truth):
private void init(){
  if (!isInEditMode())   Iconify.addIcons(this);
 else   this.setText(this.getText());
}
Program: 89948
Project: 89948
Buggy source:
private void init(){
  Iconify.addIcons(this);
}

Fixed version (ground truth):
private void init(){
  if (!isInEditMode())   Iconify.addIcons(this);
 else   this.setText("String_Node_Str");
}
Program: 89949
Project: 89949
Buggy source:
public IconDrawable(Context context,Iconify.IconValue icon){
  this.context=context;
  this.icon=icon;
  this.size=convertDpToPx(context,ANDROID_ACTIONBAR_ICON_SIZE_DP);
  paint=new TextPaint();
  paint.setTypeface(Iconify.getTypeface(context));
  paint.setStyle(Paint.Style.STROKE);
  paint.setTextAlign(Paint.Align.CENTER);
  paint.setUnderlineText(false);
  paint.setColor(Color.BLACK);
}

Fixed version (ground truth):
public IconDrawable(Context context,Iconify.IconValue icon){
  this.context=context;
  this.icon=icon;
  paint=new TextPaint();
  paint.setTypeface(Iconify.getTypeface(context));
  paint.setStyle(Paint.Style.STROKE);
  paint.setTextAlign(Paint.Align.CENTER);
  paint.setUnderlineText(false);
  paint.setColor(Color.BLACK);
}
Program: 89952
Project: 89952
Buggy source:
public ReservationUtilization getDefaultReservationUtilization(){
  return defaultUtilization;
}

Fixed version (ground truth):
public ReservationUtilization getDefaultReservationUtilization(long time){
  return defaultUtilization;
}
Program: 89953
Project: 89953
Buggy source:
/** 
 * @return
 */
Ec2InstanceReservationPrice.ReservationUtilization getDefaultReservationUtilization();

Fixed version (ground truth):
/** 
 * @return
 */
Ec2InstanceReservationPrice.ReservationUtilization getDefaultReservationUtilization(long time);
Program: 89957
Project: 89957
Buggy source:
private Map<Long,Map<Ec2InstanceReservationPrice.Key,Double>> getOndemandCosts(long fromMillis){
  Map<Long,Map<Ec2InstanceReservationPrice.Key,Double>> ondemandCostsByHour=Maps.newHashMap();
  ReadWriteData costs=costDataByProduct.get(null);
  Collection<TagGroup> tagGroups=costs.getTagGroups();
  for (int i=0; i < costs.getNum(); i++) {
    Long millis=startMilli + i * AwsUtils.hourMillis;
    if (millis <= fromMillis)     continue;
    Map<Ec2InstanceReservationPrice.Key,Double> ondemandCosts=Maps.newHashMap();
    ondemandCostsByHour.put(millis,ondemandCosts);
    Map<TagGroup,Double> data=costs.getData(i);
    for (    TagGroup tagGroup : tagGroups) {
      if (tagGroup.product == Product.ec2_instance && tagGroup.operation == Operation.ondemandInstances && data.get(tagGroup) != null) {
        Ec2InstanceReservationPrice.Key key=new Ec2InstanceReservationPrice.Key(tagGroup.region,tagGroup.usageType);
        if (ondemandCosts.get(key) != null)         ondemandCosts.put(key,data.get(tagGroup) + ondemandCosts.get(key));
 else         ondemandCosts.put(key,data.get(tagGroup));
      }
    }
  }
  return ondemandCostsByHour;
}

Fixed version (ground truth):
private Map<Long,Map<Ec2InstanceReservationPrice.Key,Double>> getOndemandCosts(long fromMillis){
  Map<Long,Map<Ec2InstanceReservationPrice.Key,Double>> ondemandCostsByHour=Maps.newHashMap();
  ReadWriteData costs=costDataByProduct.get(null);
  Collection<TagGroup> tagGroups=costs.getTagGroups();
  for (int i=0; i < costs.getNum(); i++) {
    Long millis=startMilli + i * AwsUtils.hourMillis;
    if (millis < fromMillis)     continue;
    Map<Ec2InstanceReservationPrice.Key,Double> ondemandCosts=Maps.newHashMap();
    ondemandCostsByHour.put(millis,ondemandCosts);
    Map<TagGroup,Double> data=costs.getData(i);
    for (    TagGroup tagGroup : tagGroups) {
      if (tagGroup.product == Product.ec2_instance && tagGroup.operation == Operation.ondemandInstances && data.get(tagGroup) != null) {
        Ec2InstanceReservationPrice.Key key=new Ec2InstanceReservationPrice.Key(tagGroup.region,tagGroup.usageType);
        if (ondemandCosts.get(key) != null)         ondemandCosts.put(key,data.get(tagGroup) + ondemandCosts.get(key));
 else         ondemandCosts.put(key,data.get(tagGroup));
      }
    }
  }
  return ondemandCostsByHour;
}
Program: 89958
Project: 89958
Buggy source:
@Override public int compareTo(Tag t){
  if (t instanceof Operation) {
    Operation o=(Operation)t;
    int result=this.seq - o.seq;
    return result == 0 ? this.name.compareTo(t.name) : result;
  }
 else   return this.name.compareTo(t.name);
}

Fixed version (ground truth):
@Override public int compareTo(Tag t){
  if (t instanceof Operation) {
    Operation o=(Operation)t;
    int result=this.seq - o.seq;
    return result == 0 ? this.name.compareTo(t.name) : result;
  }
 else   return super.compareTo(t);
}
Program: 89959
Project: 89959
Buggy source:
public int compareTo(Tag t){
  int result=("String_Node_Str" + this.name).compareTo("String_Node_Str" + t.name);
  return result;
}

Fixed version (ground truth):
public int compareTo(Tag t){
  if (t == aggregated)   return -t.compareTo(this);
  int result=("String_Node_Str" + this.name).compareTo("String_Node_Str" + t.name);
  return result;
}
Program: 89962
Project: 89962
Buggy source:
/** 
 * We check if new data is available periodically
 * @throws Exception
 */
@Override protected void poll() throws Exception {
  logger.info(dbName + "String_Node_Str");
  for (  DateTime key : fileCache.keySet()) {
    File file=fileCache.get(key);
    try {
      logger.info("String_Node_Str" + file);
      boolean downloaded=downloadFile(file);
      if (downloaded) {
        ReadOnlyData newData=loadDataFromFile(file);
        data.put(key,newData);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + file,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * We check if new data is available periodically
 * @throws Exception
 */
@Override protected void poll() throws Exception {
  logger.info(dbName + "String_Node_Str");
  for (  DateTime key : Sets.newHashSet(fileCache.keySet())) {
    File file=fileCache.get(key);
    try {
      logger.info("String_Node_Str" + file);
      boolean downloaded=downloadFile(file);
      if (downloaded) {
        ReadOnlyData newData=loadDataFromFile(file);
        data.put(key,newData);
        fileCache.put(key,file);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + file,e);
    }
  }
}
Program: 89964
Project: 89964
Buggy source:
/** 
 * Fetches the next location provider in the fallback list, and initializes it. If location updates have already been started, this restarts location updates.<br/><br/>If there are no location providers left, no action occurs.
 */
void fallbackProvider(){
  if (!providers.isEmpty()) {
    currentProvider=providers.poll();
    currentProvider.init(context,logger);
    if (shouldStart) {
      currentProvider.start(locationListener,locationParams,singleUpdate);
    }
  }
}

Fixed version (ground truth):
/** 
 * Fetches the next location provider in the fallback list, and initializes it. If location updates have already been started, this restarts location updates.<br/><br/>If there are no location providers left, no action occurs.
 */
void fallbackProvider(){
  if (!providers.isEmpty()) {
    currentProvider.stop();
    currentProvider=providers.poll();
    currentProvider.init(context,logger);
    if (shouldStart) {
      currentProvider.start(locationListener,locationParams,singleUpdate);
    }
  }
}
Program: 89965
Project: 89965
Buggy source:
@Test public void testMultiProviderRun(){
  TestServiceProvider testServiceProvider=new TestServiceProvider();
  ServiceConnectionListener mockListener=mock(ServiceConnectionListener.class);
  testServiceProvider.setServiceListener(mockListener);
  LocationProvider backupProvider=mock(LocationProvider.class);
  MultiFallbackProvider subject=new MultiFallbackProvider.Builder().withServiceProvider(testServiceProvider).withProvider(backupProvider).build();
  subject.init(mock(Context.class),mock(Logger.class));
  assertEquals(1,testServiceProvider.getInitCount());
  OnLocationUpdatedListener listenerMock=mock(OnLocationUpdatedListener.class);
  LocationParams paramsMock=mock(LocationParams.class);
  subject.start(listenerMock,paramsMock,false);
  assertEquals(1,testServiceProvider.getStartCount());
  testServiceProvider.simulateFailure();
  verify(mockListener).onConnectionFailed();
  verify(backupProvider).init(any(Context.class),any(Logger.class));
  verify(backupProvider).start(listenerMock,paramsMock,false);
  subject.stop();
  verify(backupProvider).stop();
  assertEquals(0,testServiceProvider.getStopCount());
  Location mockLocation=mock(Location.class);
  when(backupProvider.getLastLocation()).thenReturn(mockLocation);
  assertEquals(mockLocation,subject.getLastLocation());
  assertEquals(0,testServiceProvider.getLastLocCount());
}

Fixed version (ground truth):
@Test public void testMultiProviderRun(){
  TestServiceProvider testServiceProvider=new TestServiceProvider();
  ServiceConnectionListener mockListener=mock(ServiceConnectionListener.class);
  testServiceProvider.setServiceListener(mockListener);
  LocationProvider backupProvider=mock(LocationProvider.class);
  MultiFallbackProvider subject=new MultiFallbackProvider.Builder().withServiceProvider(testServiceProvider).withProvider(backupProvider).build();
  subject.init(mock(Context.class),mock(Logger.class));
  assertEquals(1,testServiceProvider.getInitCount());
  OnLocationUpdatedListener listenerMock=mock(OnLocationUpdatedListener.class);
  LocationParams paramsMock=mock(LocationParams.class);
  subject.start(listenerMock,paramsMock,false);
  assertEquals(1,testServiceProvider.getStartCount());
  testServiceProvider.simulateFailure();
  verify(mockListener).onConnectionFailed();
  assertEquals(1,testServiceProvider.getStopCount());
  verify(backupProvider).init(any(Context.class),any(Logger.class));
  verify(backupProvider).start(listenerMock,paramsMock,false);
  subject.stop();
  verify(backupProvider).stop();
  assertEquals(1,testServiceProvider.getStopCount());
  Location mockLocation=mock(Location.class);
  when(backupProvider.getLastLocation()).thenReturn(mockLocation);
  assertEquals(mockLocation,subject.getLastLocation());
  assertEquals(0,testServiceProvider.getLastLocCount());
}
Program: 89966
Project: 89966
Buggy source:
private Criteria getProvider(LocationParams params){
  final LocationAccuracy accuracy=params.getAccuracy();
  final Criteria criteria=new Criteria();
switch (accuracy) {
case HIGH:
    criteria.setAccuracy(Criteria.ACCURACY_HIGH);
  criteria.setPowerRequirement(Criteria.POWER_HIGH);
break;
case MEDIUM:
criteria.setAccuracy(Criteria.ACCURACY_MEDIUM);
criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
break;
case LOW:
criteria.setAccuracy(Criteria.ACCURACY_LOW);
criteria.setPowerRequirement(Criteria.POWER_LOW);
}
return criteria;
}

Fixed version (ground truth):
private Criteria getProvider(LocationParams params){
  final LocationAccuracy accuracy=params.getAccuracy();
  final Criteria criteria=new Criteria();
switch (accuracy) {
case HIGH:
    criteria.setAccuracy(Criteria.ACCURACY_COARSE);
  criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH);
criteria.setVerticalAccuracy(Criteria.ACCURACY_HIGH);
criteria.setBearingAccuracy(Criteria.ACCURACY_HIGH);
criteria.setSpeedAccuracy(Criteria.ACCURACY_HIGH);
criteria.setPowerRequirement(Criteria.POWER_HIGH);
break;
case MEDIUM:
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setHorizontalAccuracy(Criteria.ACCURACY_MEDIUM);
criteria.setVerticalAccuracy(Criteria.ACCURACY_MEDIUM);
criteria.setBearingAccuracy(Criteria.ACCURACY_MEDIUM);
criteria.setSpeedAccuracy(Criteria.ACCURACY_MEDIUM);
criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
break;
case LOW:
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setHorizontalAccuracy(Criteria.ACCURACY_LOW);
criteria.setVerticalAccuracy(Criteria.ACCURACY_LOW);
criteria.setBearingAccuracy(Criteria.ACCURACY_LOW);
criteria.setSpeedAccuracy(Criteria.ACCURACY_LOW);
criteria.setPowerRequirement(Criteria.POWER_LOW);
}
return criteria;
}