nus-yam/ex-repair huggingface dataset:
Program: 89742
Project: 89742
Buggy source:
@Override @DB public boolean deleteZone(DeleteZoneCmd cmd){
  Long userId=UserContext.current().getCallerUserId();
  Long zoneId=cmd.getId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  if (!validZone(zoneId)) {
    throw new InvalidParameterValueException("String_Node_Str" + zoneId + "String_Node_Str");
  }
  checkIfZoneIsDeletable(zoneId);
  boolean success=_zoneDao.expunge(zoneId);
  try {
    _zoneDao.deleteVnet(zoneId);
    List<NetworkVO> networks=_networkDao.listByZone(zoneId);
    if (networks != null && !networks.isEmpty()) {
      for (      NetworkVO network : networks) {
        _networkDao.remove(network.getId());
      }
    }
    List<VlanVO> vlans=_vlanDao.listByZone(zoneId);
    for (    VlanVO vlan : vlans) {
      _vlanDao.remove(vlan.getId());
    }
  }
 catch (  Exception ex) {
    s_logger.error("String_Node_Str" + zoneId);
    throw new CloudRuntimeException("String_Node_Str" + zoneId);
  }
  if (success) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override @DB public boolean deleteZone(DeleteZoneCmd cmd){
  Transaction txn=Transaction.currentTxn();
  boolean success=false;
  Long userId=UserContext.current().getCallerUserId();
  Long zoneId=cmd.getId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  if (!validZone(zoneId)) {
    throw new InvalidParameterValueException("String_Node_Str" + zoneId + "String_Node_Str");
  }
  checkIfZoneIsDeletable(zoneId);
  txn.start();
  _zoneDao.deleteVnet(zoneId);
  List<VlanVO> vlans=_vlanDao.listByZone(zoneId);
  for (  VlanVO vlan : vlans) {
    _vlanDao.remove(vlan.getId());
  }
  List<NetworkVO> networks=_networkDao.listByZoneIncludingRemoved(zoneId);
  if (networks != null && !networks.isEmpty()) {
    for (    NetworkVO network : networks) {
      _networkDao.expunge(network.getId());
    }
  }
  success=_zoneDao.expunge(zoneId);
  txn.commit();
  return success;
}
Program: 89743
Project: 89743
Buggy source:
public static ObjectName registerMBean(String objTypeName,String objInstanceName,Object mbean) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
  String name="String_Node_Str" + objTypeName;
  if (objInstanceName != null && !objInstanceName.isEmpty())   name+="String_Node_Str" + objInstanceName;
  ObjectName objectName=new ObjectName(name);
  ArrayList<MBeanServer> server=MBeanServerFactory.findMBeanServer(null);
  if (server.size() > 0) {
    MBeanServer mBeanServer=server.get(0);
    mBeanServer.registerMBean(mbean,objectName);
    return objectName;
  }
 else {
    MBeanServer mBeanServer=ManagementFactory.getPlatformMBeanServer();
    mBeanServer.registerMBean(mbean,objectName);
    return objectName;
  }
}

Fixed version (ground truth):
public static ObjectName registerMBean(String objTypeName,String objInstanceName,Object mbean) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
  String name="String_Node_Str" + objTypeName;
  if (objInstanceName != null && !objInstanceName.isEmpty())   name+="String_Node_Str" + objInstanceName;
  ObjectName objectName=new ObjectName(name);
  ArrayList<MBeanServer> server=MBeanServerFactory.findMBeanServer(null);
  if (server.size() > 0) {
    MBeanServer mBeanServer=server.get(0);
    if (!mBeanServer.isRegistered(objectName))     mBeanServer.registerMBean(mbean,objectName);
    return objectName;
  }
 else {
    MBeanServer mBeanServer=ManagementFactory.getPlatformMBeanServer();
    if (!mBeanServer.isRegistered(objectName))     mBeanServer.registerMBean(mbean,objectName);
    return objectName;
  }
}
Program: 89744
Project: 89744
Buggy source:
@Override public boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException {
  Long vlanDbId=cmd.getId();
  Long userId=UserContext.current().getCallerUserId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  VlanVO vlan=_vlanDao.findById(vlanDbId);
  if (vlan == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return deleteVlanAndPublicIpRange(userId,vlanDbId);
}

Fixed version (ground truth):
@Override @ActionEvent(eventType=EventTypes.EVENT_VLAN_IP_RANGE_DELETE,eventDescription="String_Node_Str",async=false) public boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException {
  Long vlanDbId=cmd.getId();
  Long userId=UserContext.current().getCallerUserId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  VlanVO vlan=_vlanDao.findById(vlanDbId);
  if (vlan == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return deleteVlanAndPublicIpRange(userId,vlanDbId);
}
Program: 89746
Project: 89746
Buggy source:
@Override public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone,ServiceOffering serviceOffering,VirtualMachineTemplate template,List<Long> securityGroupIdList,Account owner,String hostName,String displayName,Long diskOfferingId,Long diskSize,String group,HypervisorType hypervisor,String userData,String sshKeyPair) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
  Account caller=UserContext.current().getCaller();
  List<NetworkVO> networkList=new ArrayList<NetworkVO>();
  _accountMgr.checkAccess(caller,owner);
  NetworkVO defaultNetwork=_networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(),TrafficType.Guest);
  if (defaultNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else {
    networkList.add(defaultNetwork);
  }
  return createVirtualMachine(zone,serviceOffering,template,hostName,displayName,caller,diskOfferingId,diskSize,networkList,securityGroupIdList,group,userData,sshKeyPair,hypervisor,caller);
}

Fixed version (ground truth):
@Override public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone,ServiceOffering serviceOffering,VirtualMachineTemplate template,List<Long> securityGroupIdList,Account owner,String hostName,String displayName,Long diskOfferingId,Long diskSize,String group,HypervisorType hypervisor,String userData,String sshKeyPair) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
  Account caller=UserContext.current().getCaller();
  List<NetworkVO> networkList=new ArrayList<NetworkVO>();
  _accountMgr.checkAccess(caller,owner);
  NetworkVO defaultNetwork=_networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(),TrafficType.Guest);
  if (defaultNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else {
    networkList.add(defaultNetwork);
  }
  return createVirtualMachine(zone,serviceOffering,template,hostName,displayName,owner,diskOfferingId,diskSize,networkList,securityGroupIdList,group,userData,sshKeyPair,hypervisor,caller);
}
Program: 89747
Project: 89747
Buggy source:
private void checkConflicts() throws ConfigurationException {
  Date cutTime=DateUtil.currentGMTTime();
  List<ManagementServerHostVO> peers=_mshostDao.getActiveList(new Date(cutTime.getTime() - heartbeatThreshold));
  for (  ManagementServerHostVO peer : peers) {
    if (_mshostId == peer.getMsid()) {
      continue;
    }
    if (_clusterNodeIP.equals(peer.getServiceIP().trim())) {
      if ("String_Node_Str".equals(_clusterNodeIP)) {
        throw new ConfigurationException("String_Node_Str");
      }
 else {
        if (!pingManagementNode(peer.getId())) {
          throw new ConfigurationException("String_Node_Str" + peer.getServiceIP() + "String_Node_Str");
        }
      }
    }
  }
}

Fixed version (ground truth):
private void checkConflicts() throws ConfigurationException {
  Date cutTime=DateUtil.currentGMTTime();
  List<ManagementServerHostVO> peers=_mshostDao.getActiveList(new Date(cutTime.getTime() - heartbeatThreshold));
  for (  ManagementServerHostVO peer : peers) {
    String peerIP=peer.getServiceIP().trim();
    if (_clusterNodeIP.equals(peerIP)) {
      if ("String_Node_Str".equals(_clusterNodeIP)) {
        String msg="String_Node_Str";
        s_logger.error(msg);
        throw new ConfigurationException(msg);
      }
 else {
        if (!pingManagementNode(peer.getMsid())) {
          String msg="String_Node_Str" + peer.getServiceIP() + "String_Node_Str";
          s_logger.error(msg);
          throw new ConfigurationException(msg);
        }
      }
    }
  }
}
Program: 89748
Project: 89748
Buggy source:
@Override public String getSelfPeerName(){
  return Long.toString(_id);
}

Fixed version (ground truth):
@Override public String getSelfPeerName(){
  return Long.toString(_msid);
}
Program: 89751
Project: 89751
Buggy source:
@Override public long getManagementNodeId(){
  return _id;
}

Fixed version (ground truth):
@Override public long getManagementNodeId(){
  return _msid;
}
Program: 89752
Project: 89752
Buggy source:
@Override public boolean pingManagementNode(long msid){
  ManagementServerHostVO mshost=_mshostDao.findById(msid);
  if (mshost == null)   return false;
  String targetIp=mshost.getServiceIP();
  if ("String_Node_Str".equals(targetIp) || "String_Node_Str".equals(targetIp)) {
    s_logger.info("String_Node_Str");
    return false;
  }
  String targetPeer=String.valueOf(msid);
  ClusterService peerService=null;
  for (int i=0; i < 2; i++) {
    try {
      peerService=getPeerService(targetPeer);
    }
 catch (    RemoteException e) {
      s_logger.error("String_Node_Str" + targetPeer + "String_Node_Str");
    }
    if (peerService != null) {
      try {
        return peerService.ping(getSelfPeerName());
      }
 catch (      RemoteException e) {
        s_logger.warn("String_Node_Str",e);
        invalidatePeerService(targetPeer);
      }
    }
 else {
      s_logger.warn("String_Node_Str" + msid + "String_Node_Str");
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean pingManagementNode(long msid){
  ManagementServerHostVO mshost=_mshostDao.findByMsid(msid);
  if (mshost == null)   return false;
  String targetIp=mshost.getServiceIP();
  if ("String_Node_Str".equals(targetIp) || "String_Node_Str".equals(targetIp)) {
    s_logger.info("String_Node_Str");
    return false;
  }
  String targetPeer=String.valueOf(msid);
  ClusterService peerService=null;
  for (int i=0; i < 2; i++) {
    try {
      peerService=getPeerService(targetPeer);
    }
 catch (    RemoteException e) {
      s_logger.error("String_Node_Str" + targetPeer + "String_Node_Str");
    }
    if (peerService != null) {
      try {
        return peerService.ping(getSelfPeerName());
      }
 catch (      RemoteException e) {
        s_logger.warn("String_Node_Str",e);
        invalidatePeerService(targetPeer);
      }
    }
 else {
      s_logger.warn("String_Node_Str" + msid + "String_Node_Str");
    }
  }
  return false;
}
Program: 89753
Project: 89753
Buggy source:
@Override public ClusterService getPeerService(String strPeer) throws RemoteException {
  String serviceUrl=getServiceEndpointName(strPeer);
  return new ClusterServiceServletImpl(serviceUrl);
}

Fixed version (ground truth):
@Override public ClusterService getPeerService(String strPeer) throws RemoteException {
  String serviceUrl=getServiceEndpointName(strPeer);
  if (serviceUrl == null)   return null;
  return new ClusterServiceServletImpl(serviceUrl);
}
Program: 89756
Project: 89756
Buggy source:
protected ClusterDaoImpl(){
  super();
  HyTypeWithoutGuidSearch=createSearchBuilder();
  HyTypeWithoutGuidSearch.and("String_Node_Str",HyTypeWithoutGuidSearch.entity().getHypervisorType(),SearchCriteria.Op.EQ);
  HyTypeWithoutGuidSearch.and("String_Node_Str",HyTypeWithoutGuidSearch.entity().getGuid(),SearchCriteria.Op.NULL);
  HyTypeWithoutGuidSearch.done();
  ZoneHyTypeSearch=createSearchBuilder();
  ZoneHyTypeSearch.and("String_Node_Str",ZoneHyTypeSearch.entity().getHypervisorType(),SearchCriteria.Op.EQ);
  ZoneHyTypeSearch.and("String_Node_Str",ZoneHyTypeSearch.entity().getPodId(),SearchCriteria.Op.EQ);
  ZoneHyTypeSearch.done();
  PodSearch=createSearchBuilder();
  PodSearch.and("String_Node_Str",PodSearch.entity().getPodId(),SearchCriteria.Op.EQ);
  PodSearch.and("String_Node_Str",PodSearch.entity().getName(),SearchCriteria.Op.EQ);
  PodSearch.done();
  ZoneSearch=createSearchBuilder();
  ZoneSearch.and("String_Node_Str",ZoneSearch.entity().getPodId(),SearchCriteria.Op.EQ);
  ZoneSearch.done();
  AvailHyperSearch=createSearchBuilder();
  AvailHyperSearch.and("String_Node_Str",AvailHyperSearch.entity().getDataCenterId(),SearchCriteria.Op.EQ);
  AvailHyperSearch.groupBy(AvailHyperSearch.entity().getHypervisorType());
  AvailHyperSearch.done();
}

Fixed version (ground truth):
protected ClusterDaoImpl(){
  super();
  HyTypeWithoutGuidSearch=createSearchBuilder();
  HyTypeWithoutGuidSearch.and("String_Node_Str",HyTypeWithoutGuidSearch.entity().getHypervisorType(),SearchCriteria.Op.EQ);
  HyTypeWithoutGuidSearch.and("String_Node_Str",HyTypeWithoutGuidSearch.entity().getGuid(),SearchCriteria.Op.NULL);
  HyTypeWithoutGuidSearch.done();
  ZoneHyTypeSearch=createSearchBuilder();
  ZoneHyTypeSearch.and("String_Node_Str",ZoneHyTypeSearch.entity().getHypervisorType(),SearchCriteria.Op.EQ);
  ZoneHyTypeSearch.and("String_Node_Str",ZoneHyTypeSearch.entity().getPodId(),SearchCriteria.Op.EQ);
  ZoneHyTypeSearch.done();
  PodSearch=createSearchBuilder();
  PodSearch.and("String_Node_Str",PodSearch.entity().getPodId(),SearchCriteria.Op.EQ);
  PodSearch.and("String_Node_Str",PodSearch.entity().getName(),SearchCriteria.Op.EQ);
  PodSearch.done();
  ZoneSearch=createSearchBuilder();
  ZoneSearch.and("String_Node_Str",ZoneSearch.entity().getDataCenterId(),SearchCriteria.Op.EQ);
  ZoneSearch.done();
  AvailHyperSearch=createSearchBuilder();
  AvailHyperSearch.and("String_Node_Str",AvailHyperSearch.entity().getDataCenterId(),SearchCriteria.Op.EQ);
  AvailHyperSearch.groupBy(AvailHyperSearch.entity().getHypervisorType());
  AvailHyperSearch.done();
}
Program: 89757
Project: 89757
Buggy source:
@Override public String[] getHypervisors(ListHypervisorsCmd cmd){
  Long zoneId=cmd.getZoneId();
  if (zoneId == null) {
    String hypers=_configDao.getValue(Config.HypervisorList.key());
    if (hypers == "String_Node_Str" || hypers == null) {
      return null;
    }
    return hypers.split("String_Node_Str");
  }
 else {
    String[] result=null;
    List<ClusterVO> clustersForZone=_clusterDao.listByZoneId(zoneId);
    if (clustersForZone != null && clustersForZone.size() > 0) {
      result=new String[clustersForZone.size()];
      int i=0;
      for (      ClusterVO cluster : clustersForZone) {
        result[i++]=cluster.getHypervisorType().toString();
      }
    }
    return result;
  }
}

Fixed version (ground truth):
@Override public String[] getHypervisors(ListHypervisorsCmd cmd){
  Long zoneId=cmd.getZoneId();
  if (zoneId == null) {
    String hypers=_configDao.getValue(Config.HypervisorList.key());
    if (hypers == "String_Node_Str" || hypers == null) {
      return null;
    }
    return hypers.split("String_Node_Str");
  }
 else {
    int i=0;
    List<ClusterVO> clustersForZone=_clusterDao.listByZoneId(zoneId);
    if (clustersForZone != null && clustersForZone.size() > 0) {
      Set<String> result=new HashSet<String>();
      for (      ClusterVO cluster : clustersForZone) {
        result.add(cluster.getHypervisorType().toString());
      }
      String[] resultArray=new String[result.size()];
      for (      String entity : result) {
        resultArray[i++]=entity;
      }
      return resultArray;
    }
  }
  return null;
}
Program: 89758
Project: 89758
Buggy source:
@Override @ActionEvent(eventType=EventTypes.EVENT_NETWORK_DELETE,eventDescription="String_Node_Str",async=true) public boolean deleteNetwork(long networkId){
  int nicCount=getActiveNicsInNetwork(networkId);
  if (nicCount > 0) {
    throw new InvalidParameterValueException("String_Node_Str" + networkId + "String_Node_Str");
  }
  Account caller=UserContext.current().getCaller();
  NetworkVO network=_networksDao.findById(networkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str" + networkId);
  }
  Account owner=_accountMgr.getAccount(network.getAccountId());
  if (!_accountMgr.isAdmin(caller.getType())) {
    if (network.getAccountId() != caller.getId()) {
      throw new PermissionDeniedException("String_Node_Str" + caller.getAccountName() + "String_Node_Str"+ networkId+ "String_Node_Str");
    }
  }
 else {
    _accountMgr.checkAccess(caller,owner);
  }
  List<UserVmVO> userVms=_vmDao.listByNetworkId(networkId);
  for (  UserVmVO vm : userVms) {
    if (!(vm.getState() == VirtualMachine.State.Error || (vm.getState() == VirtualMachine.State.Expunging && vm.getRemoved() != null))) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  User callerUser=_accountMgr.getActiveUser(UserContext.current().getCallerUserId());
  ReservationContext context=new ReservationContextImpl(null,null,callerUser,owner);
  return deleteNetworkInternal(networkId,context);
}

Fixed version (ground truth):
@Override @ActionEvent(eventType=EventTypes.EVENT_NETWORK_DELETE,eventDescription="String_Node_Str",async=true) public boolean deleteNetwork(long networkId){
  Account caller=UserContext.current().getCaller();
  NetworkVO network=_networksDao.findById(networkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str" + networkId);
  }
  Account owner=_accountMgr.getAccount(network.getAccountId());
  if (!_accountMgr.isAdmin(caller.getType())) {
    if (network.getAccountId() != caller.getId()) {
      throw new PermissionDeniedException("String_Node_Str" + caller.getAccountName() + "String_Node_Str"+ networkId+ "String_Node_Str");
    }
  }
 else {
    _accountMgr.checkAccess(caller,owner);
  }
  User callerUser=_accountMgr.getActiveUser(UserContext.current().getCallerUserId());
  ReservationContext context=new ReservationContextImpl(null,null,callerUser,owner);
  return destroyNetwork(networkId,context);
}
Program: 89761
Project: 89761
Buggy source:
@Override public boolean revokePortForwardingRulesForVm(long vmId){
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByVm(vmId);
  Set<Long> ipsToReprogram=new HashSet<Long>();
  if (rules == null || rules.isEmpty()) {
    s_logger.debug("String_Node_Str" + vmId);
    return true;
  }
  for (  PortForwardingRuleVO rule : rules) {
    revokePortForwardingRuleInternal(rule.getId(),_accountMgr.getSystemAccount(),Account.ACCOUNT_ID_SYSTEM,false);
    ipsToReprogram.add(rule.getSourceIpAddressId());
  }
  for (  Long ipId : ipsToReprogram) {
    s_logger.debug("String_Node_Str" + ipId + "String_Node_Str");
    applyPortForwardingRules(ipId,true,_accountMgr.getSystemAccount());
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean revokePortForwardingRulesForVm(long vmId){
  boolean success=true;
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByVm(vmId);
  Set<Long> ipsToReprogram=new HashSet<Long>();
  if (rules == null || rules.isEmpty()) {
    s_logger.debug("String_Node_Str" + vmId);
    return true;
  }
  for (  PortForwardingRuleVO rule : rules) {
    revokePortForwardingRuleInternal(rule.getId(),_accountMgr.getSystemAccount(),Account.ACCOUNT_ID_SYSTEM,false);
    ipsToReprogram.add(rule.getSourceIpAddressId());
  }
  for (  Long ipId : ipsToReprogram) {
    s_logger.debug("String_Node_Str" + ipId + "String_Node_Str");
    if (!applyPortForwardingRules(ipId,true,_accountMgr.getSystemAccount())) {
      s_logger.warn("String_Node_Str" + ipId);
      success=false;
    }
  }
  return success;
}
Program: 89762
Project: 89762
Buggy source:
@Override public boolean revokeStaticNatRulesForVm(long vmId){
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<FirewallRuleVO> rules=_firewallDao.listStaticNatByVmId(vm.getId());
  Set<Long> ipsToReprogram=new HashSet<Long>();
  if (rules == null || rules.isEmpty()) {
    s_logger.debug("String_Node_Str" + vmId);
    return true;
  }
  for (  FirewallRuleVO rule : rules) {
    revokeStaticNatRuleInternal(rule.getId(),_accountMgr.getSystemAccount(),Account.ACCOUNT_ID_SYSTEM,false);
    ipsToReprogram.add(rule.getSourceIpAddressId());
  }
  for (  Long ipId : ipsToReprogram) {
    s_logger.debug("String_Node_Str" + ipId + "String_Node_Str");
    applyStaticNatRules(ipId,true,_accountMgr.getSystemAccount());
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean revokeStaticNatRulesForVm(long vmId){
  boolean success=true;
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<FirewallRuleVO> rules=_firewallDao.listStaticNatByVmId(vm.getId());
  Set<Long> ipsToReprogram=new HashSet<Long>();
  if (rules == null || rules.isEmpty()) {
    s_logger.debug("String_Node_Str" + vmId);
    return true;
  }
  for (  FirewallRuleVO rule : rules) {
    revokeStaticNatRuleInternal(rule.getId(),_accountMgr.getSystemAccount(),Account.ACCOUNT_ID_SYSTEM,false);
    ipsToReprogram.add(rule.getSourceIpAddressId());
  }
  for (  Long ipId : ipsToReprogram) {
    s_logger.debug("String_Node_Str" + ipId + "String_Node_Str");
    if (!applyStaticNatRules(ipId,true,_accountMgr.getSystemAccount())) {
      success=false;
      s_logger.warn("String_Node_Str" + ipId);
    }
  }
  return success;
}
Program: 89763
Project: 89763
Buggy source:
boolean cleanupAccount(AccountVO account,long callerUserId,Account caller) throws ConcurrentOperationException, ResourceUnavailableException ;

Fixed version (ground truth):
boolean cleanupAccount(AccountVO account,long callerUserId,Account caller);
Program: 89765
Project: 89765
Buggy source:
@Override public boolean deleteAccount(AccountVO account,long callerUserId,Account caller){
  long accountId=account.getId();
  try {
    if (!_accountDao.remove(accountId)) {
      s_logger.error("String_Node_Str" + accountId);
      return false;
    }
    List<UserVO> users=_userDao.listByAccount(accountId);
    for (    UserVO user : users) {
      _userDao.remove(user.getId());
    }
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + accountId);
    }
    cleanupAccount(account,callerUserId,caller);
    return true;
  }
 catch (  Exception e) {
    s_logger.error("String_Node_Str" + accountId,e);
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean deleteAccount(AccountVO account,long callerUserId,Account caller){
  long accountId=account.getId();
  if (!_accountDao.remove(accountId)) {
    s_logger.error("String_Node_Str" + accountId);
    return false;
  }
  List<UserVO> users=_userDao.listByAccount(accountId);
  for (  UserVO user : users) {
    _userDao.remove(user.getId());
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + accountId);
  }
  return cleanupAccount(account,callerUserId,caller);
}
Program: 89767
Project: 89767
Buggy source:
private static String getResetResultMessage(){
  ExceptionResponse resultObject=new ExceptionResponse();
  resultObject.setErrorCode(BaseCmd.INTERNAL_ERROR);
  resultObject.setErrorText("String_Node_Str");
  return ApiSerializerHelper.toSerializedStringOld(resultObject);
}

Fixed version (ground truth):
private static String getResetResultMessage(String messageText){
  ExceptionResponse resultObject=new ExceptionResponse();
  resultObject.setErrorCode(BaseCmd.INTERNAL_ERROR);
  resultObject.setErrorText(messageText);
  return ApiSerializerHelper.toSerializedStringOld(resultObject);
}
Program: 89768
Project: 89768
Buggy source:
@Override public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,long selfNodeId){
  for (  ManagementServerHostVO msHost : nodeList) {
    Transaction txn=Transaction.open(Transaction.CLOUD_DB);
    try {
      txn.start();
      List<SyncQueueItemVO> items=_queueMgr.getActiveQueueItems(msHost.getId(),true);
      cleanupPendingJobs(items);
      _queueMgr.resetQueueProcess(msHost.getId());
      _jobDao.resetJobProcess(msHost.getId(),BaseCmd.INTERNAL_ERROR,getResetResultMessage());
      txn.commit();
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str",e);
      txn.rollback();
    }
 finally {
      txn.close();
    }
  }
}

Fixed version (ground truth):
@Override public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,long selfNodeId){
  for (  ManagementServerHostVO msHost : nodeList) {
    Transaction txn=Transaction.open(Transaction.CLOUD_DB);
    try {
      txn.start();
      List<SyncQueueItemVO> items=_queueMgr.getActiveQueueItems(msHost.getId(),true);
      cleanupPendingJobs(items);
      _queueMgr.resetQueueProcess(msHost.getId());
      _jobDao.resetJobProcess(msHost.getId(),BaseCmd.INTERNAL_ERROR,getResetResultMessage("String_Node_Str"));
      txn.commit();
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str",e);
      txn.rollback();
    }
 finally {
      txn.close();
    }
  }
}
Program: 89769
Project: 89769
Buggy source:
private void reallyRun(){
  try {
    s_logger.trace("String_Node_Str");
    Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
    List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
    if (l != null && l.size() > 0) {
      for (      AsyncJobVO job : l) {
        _jobDao.expunge(job.getId());
      }
    }
    List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
    if (blockItems != null && blockItems.size() > 0) {
      for (      SyncQueueItemVO item : blockItems) {
        if (item.getContentType().equalsIgnoreCase("String_Node_Str"))         completeAsyncJob(item.getContentId(),2,0,"String_Node_Str");
        _queueMgr.purgeItem(item.getId());
      }
    }
    s_logger.trace("String_Node_Str");
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str",e);
  }
 finally {
    StackMaid.current().exitCleanup();
  }
}

Fixed version (ground truth):
private void reallyRun(){
  try {
    s_logger.trace("String_Node_Str");
    Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
    List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
    if (l != null && l.size() > 0) {
      for (      AsyncJobVO job : l) {
        _jobDao.expunge(job.getId());
      }
    }
    List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
    if (blockItems != null && blockItems.size() > 0) {
      for (      SyncQueueItemVO item : blockItems) {
        if (item.getContentType().equalsIgnoreCase("String_Node_Str"))         completeAsyncJob(item.getContentId(),2,0,getResetResultMessage("String_Node_Str"));
        _queueMgr.purgeItem(item.getId());
      }
    }
    s_logger.trace("String_Node_Str");
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str",e);
  }
 finally {
    StackMaid.current().exitCleanup();
  }
}
Program: 89770
Project: 89770
Buggy source:
private void cleanupPendingJobs(List<SyncQueueItemVO> l){
  if (l != null && l.size() > 0) {
    for (    SyncQueueItemVO item : l) {
      if (s_logger.isInfoEnabled())       s_logger.info("String_Node_Str" + item.toString());
      String contentType=item.getContentType();
      if (contentType != null && contentType.equals("String_Node_Str")) {
        Long jobId=item.getContentId();
        if (jobId != null) {
          s_logger.warn("String_Node_Str" + jobId);
          completeAsyncJob(jobId,AsyncJobResult.STATUS_FAILED,0,"String_Node_Str");
        }
      }
      _queueMgr.purgeItem(item.getId());
    }
  }
}

Fixed version (ground truth):
private void cleanupPendingJobs(List<SyncQueueItemVO> l){
  if (l != null && l.size() > 0) {
    for (    SyncQueueItemVO item : l) {
      if (s_logger.isInfoEnabled())       s_logger.info("String_Node_Str" + item.toString());
      String contentType=item.getContentType();
      if (contentType != null && contentType.equals("String_Node_Str")) {
        Long jobId=item.getContentId();
        if (jobId != null) {
          s_logger.warn("String_Node_Str" + jobId);
          completeAsyncJob(jobId,AsyncJobResult.STATUS_FAILED,0,getResetResultMessage("String_Node_Str"));
        }
      }
      _queueMgr.purgeItem(item.getId());
    }
  }
}
Program: 89771
Project: 89771
Buggy source:
@DB private Runnable getGCTask(){
  return new Runnable(){
    @Override public void run(){
      GlobalLock scanLock=GlobalLock.getInternLock("String_Node_Str");
      try {
        if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
          try {
            reallyRun();
          }
  finally {
            scanLock.unlock();
          }
        }
      }
  finally {
        scanLock.releaseRef();
      }
    }
    private void reallyRun(){
      try {
        s_logger.trace("String_Node_Str");
        Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
        List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
        if (l != null && l.size() > 0) {
          for (          AsyncJobVO job : l) {
            _jobDao.expunge(job.getId());
          }
        }
        List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
        if (blockItems != null && blockItems.size() > 0) {
          for (          SyncQueueItemVO item : blockItems) {
            if (item.getContentType().equalsIgnoreCase("String_Node_Str"))             completeAsyncJob(item.getContentId(),2,0,"String_Node_Str");
            _queueMgr.purgeItem(item.getId());
          }
        }
        s_logger.trace("String_Node_Str");
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str",e);
      }
 finally {
        StackMaid.current().exitCleanup();
      }
    }
  }
;
}

Fixed version (ground truth):
@DB private Runnable getGCTask(){
  return new Runnable(){
    @Override public void run(){
      GlobalLock scanLock=GlobalLock.getInternLock("String_Node_Str");
      try {
        if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
          try {
            reallyRun();
          }
  finally {
            scanLock.unlock();
          }
        }
      }
  finally {
        scanLock.releaseRef();
      }
    }
    private void reallyRun(){
      try {
        s_logger.trace("String_Node_Str");
        Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
        List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
        if (l != null && l.size() > 0) {
          for (          AsyncJobVO job : l) {
            _jobDao.expunge(job.getId());
          }
        }
        List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
        if (blockItems != null && blockItems.size() > 0) {
          for (          SyncQueueItemVO item : blockItems) {
            if (item.getContentType().equalsIgnoreCase("String_Node_Str"))             completeAsyncJob(item.getContentId(),2,0,getResetResultMessage("String_Node_Str"));
            _queueMgr.purgeItem(item.getId());
          }
        }
        s_logger.trace("String_Node_Str");
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str",e);
      }
 finally {
        StackMaid.current().exitCleanup();
      }
    }
  }
;
}
Program: 89772
Project: 89772
Buggy source:
@Override public boolean start(){
  try {
    List<SyncQueueItemVO> l=_queueMgr.getActiveQueueItems(getMsid(),false);
    cleanupPendingJobs(l);
    _queueMgr.resetQueueProcess(getMsid());
    _jobDao.resetJobProcess(getMsid(),BaseCmd.INTERNAL_ERROR,getResetResultMessage());
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
  _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(),HEARTBEAT_INTERVAL,HEARTBEAT_INTERVAL,TimeUnit.MILLISECONDS);
  _heartbeatScheduler.scheduleAtFixedRate(getGCTask(),GC_INTERVAL,GC_INTERVAL,TimeUnit.MILLISECONDS);
  return true;
}

Fixed version (ground truth):
@Override public boolean start(){
  try {
    List<SyncQueueItemVO> l=_queueMgr.getActiveQueueItems(getMsid(),false);
    cleanupPendingJobs(l);
    _queueMgr.resetQueueProcess(getMsid());
    _jobDao.resetJobProcess(getMsid(),BaseCmd.INTERNAL_ERROR,getResetResultMessage("String_Node_Str"));
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
  _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(),HEARTBEAT_INTERVAL,HEARTBEAT_INTERVAL,TimeUnit.MILLISECONDS);
  _heartbeatScheduler.scheduleAtFixedRate(getGCTask(),GC_INTERVAL,GC_INTERVAL,TimeUnit.MILLISECONDS);
  return true;
}
Program: 89773
Project: 89773
Buggy source:
private boolean default_network_rules_for_systemvm(Connect conn,String vmName){
  if (!_can_bridge_firewall) {
    return false;
  }
  List<InterfaceDef> intfs=getInterfaces(conn,vmName);
  if (intfs.size() < 1) {
    return false;
  }
  InterfaceDef intf=intfs.get(intfs.size() - 1);
  String brname=intf.getBrName();
  Script cmd=new Script(_securityGroupPath,_timeout,s_logger);
  cmd.add("String_Node_Str");
  cmd.add("String_Node_Str",vmName);
  cmd.add("String_Node_Str",brname);
  String result=cmd.execute();
  if (result != null) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean default_network_rules_for_systemvm(Connect conn,String vmName){
  if (!_can_bridge_firewall) {
    return false;
  }
  List<InterfaceDef> intfs=getInterfaces(conn,vmName);
  if (intfs.size() < 1) {
    return false;
  }
  String brname=null;
  if (vmName.startsWith("String_Node_Str")) {
    InterfaceDef intf=intfs.get(0);
    brname=intf.getBrName();
  }
 else {
    InterfaceDef intf=intfs.get(intfs.size() - 1);
    brname=intf.getBrName();
  }
  Script cmd=new Script(_securityGroupPath,_timeout,s_logger);
  cmd.add("String_Node_Str");
  cmd.add("String_Node_Str",vmName);
  cmd.add("String_Node_Str",brname);
  String result=cmd.execute();
  if (result != null) {
    return false;
  }
  return true;
}
Program: 89774
Project: 89774
Buggy source:
@Override public Network design(NetworkOffering offering,DeploymentPlan plan,Network userSpecified,Account owner){
  DataCenter dc=_dcDao.findById(plan.getDataCenterId());
  if (!canHandle(offering,dc)) {
    return null;
  }
  State state=State.Allocated;
  if (offering.isSystemOnly()) {
    state=State.Setup;
  }
  NetworkVO config=new NetworkVO(offering.getTrafficType(),offering.getGuestType(),Mode.Dhcp,BroadcastDomainType.Vlan,offering.getId(),plan.getDataCenterId(),state);
  if (userSpecified != null) {
    if ((userSpecified.getCidr() == null && userSpecified.getGateway() != null) || (userSpecified.getCidr() != null && userSpecified.getGateway() == null)) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    config.setSecurityGroupEnabled(userSpecified.isSecurityGroupEnabled());
    if (userSpecified.getCidr() != null) {
      config.setCidr(userSpecified.getCidr());
      config.setGateway(userSpecified.getGateway());
    }
    if (userSpecified.getBroadcastUri() != null) {
      config.setBroadcastUri(userSpecified.getBroadcastUri());
      config.setState(State.Setup);
    }
    if (userSpecified.getBroadcastDomainType() != null) {
      config.setBroadcastDomainType(userSpecified.getBroadcastDomainType());
    }
  }
  return config;
}

Fixed version (ground truth):
@Override public Network design(NetworkOffering offering,DeploymentPlan plan,Network userSpecified,Account owner){
  DataCenter dc=_dcDao.findById(plan.getDataCenterId());
  if (!canHandle(offering,dc)) {
    return null;
  }
  State state=State.Allocated;
  if (offering.isSystemOnly()) {
    state=State.Setup;
  }
  NetworkVO config=new NetworkVO(offering.getTrafficType(),offering.getGuestType(),Mode.Dhcp,BroadcastDomainType.Vlan,offering.getId(),plan.getDataCenterId(),state);
  if (userSpecified != null) {
    if ((userSpecified.getCidr() == null && userSpecified.getGateway() != null) || (userSpecified.getCidr() != null && userSpecified.getGateway() == null)) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    config.setSecurityGroupEnabled(userSpecified.isSecurityGroupEnabled());
    if (userSpecified.getCidr() != null) {
      config.setCidr(userSpecified.getCidr());
      config.setGateway(userSpecified.getGateway());
    }
    if (userSpecified.getBroadcastUri() != null) {
      config.setBroadcastUri(userSpecified.getBroadcastUri());
      config.setState(State.Setup);
    }
    if (userSpecified.getBroadcastDomainType() != null) {
      config.setBroadcastDomainType(userSpecified.getBroadcastDomainType());
    }
  }
  if (config.isSecurityGroupEnabled()) {
    config.setName("String_Node_Str");
    config.setDisplayText("String_Node_Str");
  }
  return config;
}
Program: 89775
Project: 89775
Buggy source:
protected void handleVmMigrated(VMInstanceVO vm){
  if (vm.getType() == VirtualMachine.Type.User)   return;
  NetworkRulesSystemVmCommand nrc=new NetworkRulesSystemVmCommand(vm.getInstanceName(),vm.getType());
  Commands cmds=new Commands(nrc);
  try {
    _agentMgr.send(vm.getHostId(),cmds);
  }
 catch (  AgentUnavailableException e) {
    s_logger.debug(e.toString());
  }
catch (  OperationTimedoutException e) {
    s_logger.debug(e.toString());
  }
}

Fixed version (ground truth):
protected void handleVmMigrated(VMInstanceVO vm){
  if (vm.getType() == VirtualMachine.Type.User || !isVmSecurityGroupEnabled(vm.getId()))   return;
  NetworkRulesSystemVmCommand nrc=new NetworkRulesSystemVmCommand(vm.getInstanceName(),vm.getType());
  Commands cmds=new Commands(nrc);
  try {
    _agentMgr.send(vm.getHostId(),cmds);
  }
 catch (  AgentUnavailableException e) {
    s_logger.debug(e.toString());
  }
catch (  OperationTimedoutException e) {
    s_logger.debug(e.toString());
  }
}
Program: 89776
Project: 89776
Buggy source:
@Override public boolean finalizeCommandsOnStart(Commands cmds,VirtualMachineProfile<ConsoleProxyVO> profile){
  NicProfile controlNic=(NicProfile)profile.getParameter(VirtualMachineProfile.Param.ControlNic);
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeCommandsOnStart(Commands cmds,VirtualMachineProfile<ConsoleProxyVO> profile){
  NicProfile managementNic=null;
  NicProfile controlNic=null;
  for (  NicProfile nic : profile.getNics()) {
    if (nic.getTrafficType() == TrafficType.Management) {
      managementNic=nic;
    }
 else     if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) {
      controlNic=nic;
    }
  }
  if (controlNic == null) {
    assert(managementNic != null);
    controlNic=managementNic;
  }
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  return true;
}
Program: 89780
Project: 89780
Buggy source:
@Override public boolean finalizeCommandsOnStart(Commands cmds,VirtualMachineProfile<SecondaryStorageVmVO> profile){
  NicProfile controlNic=(NicProfile)profile.getParameter(VirtualMachineProfile.Param.ControlNic);
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeCommandsOnStart(Commands cmds,VirtualMachineProfile<SecondaryStorageVmVO> profile){
  NicProfile managementNic=null;
  NicProfile controlNic=null;
  for (  NicProfile nic : profile.getNics()) {
    if (nic.getTrafficType() == TrafficType.Management) {
      managementNic=nic;
    }
 else     if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) {
      controlNic=nic;
    }
  }
  if (controlNic == null) {
    assert(managementNic != null);
    controlNic=managementNic;
  }
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  return true;
}
Program: 89783
Project: 89783
Buggy source:
List<FirewallRuleVO> listByIpAndPurpose(long ipAddressId,FirewallRule.Purpose purpose);

Fixed version (ground truth):
List<? extends FirewallRule> listByIpAndPurpose(long ipAddressId,FirewallRule.Purpose purpose);
Program: 89785
Project: 89785
Buggy source:
private boolean canHandle(GuestIpType ipType,DeployDestination dest,TrafficType trafficType){
  DataCenter dc=dest.getDataCenter();
  String provider=dc.getGatewayProvider();
  if (provider.equals(Provider.VirtualRouter.getName())) {
    if (dc.getNetworkType() == NetworkType.Basic) {
      return (ipType == GuestIpType.Direct && trafficType == TrafficType.Guest);
    }
 else {
      return (ipType == GuestIpType.Direct);
    }
  }
 else {
    return (ipType == GuestIpType.Virtual);
  }
}

Fixed version (ground truth):
private boolean canHandle(GuestIpType ipType,DeployDestination dest,TrafficType trafficType){
  DataCenter dc=dest.getDataCenter();
  String provider=dc.getGatewayProvider();
  if (provider.equalsIgnoreCase(Provider.JuniperSRX.getName()) && ipType == GuestIpType.Virtual) {
    return true;
  }
 else {
    if (dc.getNetworkType() == NetworkType.Basic) {
      return (ipType == GuestIpType.Direct && trafficType == TrafficType.Guest);
    }
 else {
      return (ipType == GuestIpType.Direct);
    }
  }
}
Program: 89786
Project: 89786
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  _hostCapacityCheckerDelay=NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerWait.key()),3600);
  _hostCapacityCheckerInterval=NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerInterval.key()),3600);
  _vmCapacityReleaseInterval=NumbersUtil.parseInt(_configDao.getValue(Config.VmHostCapacityReleaseInterval.key()),86400);
  _executor=Executors.newScheduledThreadPool(1,new NamedThreadFactory("String_Node_Str"));
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  _hostCapacityCheckerDelay=NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerWait.key()),3600);
  _hostCapacityCheckerInterval=NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerInterval.key()),3600);
  _vmCapacityReleaseInterval=NumbersUtil.parseInt(_configDao.getValue(Config.VmHostCapacityReleaseInterval.key()),86400);
  _executor=Executors.newScheduledThreadPool(1,new NamedThreadFactory("String_Node_Str"));
  VirtualMachine.State.getStateMachine().registerListener(this);
  return true;
}
Program: 89787
Project: 89787
Buggy source:
@Override public boolean postStateTransitionEvent(State oldState,Event event,State newState,VirtualMachine vm,boolean status){
  if (!_isEnabled || !status || (vm.getType() != VirtualMachine.Type.User && vm.getType() != VirtualMachine.Type.DomainRouter)) {
    return false;
  }
  if (VirtualMachine.State.isVmStarted(oldState,event,newState)) {
    _mgr.handleVmStateTransition((VMInstanceVO)vm,State.Running);
  }
 else   if (VirtualMachine.State.isVmMigrated(oldState,event,newState)) {
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean postStateTransitionEvent(State oldState,Event event,State newState,VirtualMachine vm,boolean status,Long oldHostId){
  if (!_isEnabled || !status || (vm.getType() != VirtualMachine.Type.User && vm.getType() != VirtualMachine.Type.DomainRouter)) {
    return false;
  }
  if (VirtualMachine.State.isVmStarted(oldState,event,newState)) {
    _mgr.handleVmStateTransition((VMInstanceVO)vm,State.Running);
  }
 else   if (VirtualMachine.State.isVmMigrated(oldState,event,newState)) {
  }
  return true;
}
Program: 89788
Project: 89788
Buggy source:
@Override public boolean postStateTransitionEvent(State oldState,Event event,State newState,VirtualMachine vm,boolean status){
  if (!status) {
    return false;
  }
  if (VirtualMachine.State.isVmStarted(oldState,event,newState)) {
    handleVmStarted((VMInstanceVO)vm);
  }
 else   if (VirtualMachine.State.isVmStopped(oldState,event,newState)) {
    handleVmStopped((VMInstanceVO)vm);
  }
 else   if (VirtualMachine.State.isVmMigrated(oldState,event,newState)) {
    handleVmMigrated((VMInstanceVO)vm);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean postStateTransitionEvent(State oldState,Event event,State newState,VirtualMachine vm,boolean status,Long oldHostId){
  if (!status) {
    return false;
  }
  if (VirtualMachine.State.isVmStarted(oldState,event,newState)) {
    handleVmStarted((VMInstanceVO)vm);
  }
 else   if (VirtualMachine.State.isVmStopped(oldState,event,newState)) {
    handleVmStopped((VMInstanceVO)vm);
  }
 else   if (VirtualMachine.State.isVmMigrated(oldState,event,newState)) {
    handleVmMigrated((VMInstanceVO)vm);
  }
  return true;
}
Program: 89789
Project: 89789
Buggy source:
@Override public boolean stateTransitTo(VMInstanceVO vm,VirtualMachine.Event e,Long hostId){
  return _stateMachine.transitTo(vm,e,hostId,_vmDao);
}

Fixed version (ground truth):
@Override public boolean stateTransitTo(VMInstanceVO vm,VirtualMachine.Event e,Long hostId){
  State oldState=vm.getState();
  if (oldState == State.Starting) {
    if (e == Event.OperationSucceeded) {
      vm.setLastHostId(hostId);
    }
  }
  return _stateMachine.transitTo(vm,e,hostId,_vmDao);
}