nus-yam/ex-repair huggingface dataset:
Program: 105439
Project: 105439
Buggy source:
@Override public Long getSyncObjId(){
  return _firewallService.getFirewallRule(id).getNetworkId();
}

Fixed version (ground truth):
@Override public Long getSyncObjId(){
  FirewallRule fw=_firewallService.getFirewallRule(id);
  if (fw != null)   return fw.getNetworkId();
  return null;
}
Program: 105440
Project: 105440
Buggy source:
@Override @Before public void setUp(){
  addIpToVmNicCmd=new AddIpToVmNicCmd(){
  }
;
  removeIpFromVmNicCmd=new RemoveIpFromVmNicCmd();
}

Fixed version (ground truth):
@Override @Before public void setUp(){
}
Program: 105441
Project: 105441
Buggy source:
@Test public void testRemoveIpFromVmNicSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
  NetworkService networkService=Mockito.mock(NetworkService.class);
  RemoveIpFromVmNicCmd removeIpFromNic=Mockito.mock(RemoveIpFromVmNicCmd.class);
  Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(true);
  removeIpFromNic._networkService=networkService;
  successResponseGenerator=Mockito.mock(SuccessResponse.class);
  removeIpFromNic.execute();
}

Fixed version (ground truth):
@Test public void testRemoveIpFromVmNicSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
  NetworkService networkService=Mockito.mock(NetworkService.class);
  RemoveIpFromVmNicCmd removeIpFromNic=Mockito.mock(RemoveIpFromVmNicCmd.class);
  Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(true);
  removeIpFromNic._networkService=networkService;
  removeIpFromNic.execute();
}
Program: 105443
Project: 105443
Buggy source:
private String getXml(String filename){
  try {
    String xmlFilePath=Script.findScript(scriptsDir,filename);
    if (xmlFilePath == null) {
      throw new Exception("String_Node_Str" + filename);
    }
    FileReader fr=new FileReader(xmlFilePath);
    BufferedReader br=new BufferedReader(fr);
    String xml="String_Node_Str";
    String line;
    while ((line=br.readLine()) != null) {
      xml+=line.trim();
    }
    return xml;
  }
 catch (  Exception e) {
    s_logger.debug(e);
    return null;
  }
}

Fixed version (ground truth):
private String getXml(String filename){
  try {
    String xmlFilePath=Script.findScript(scriptsDir,filename);
    if (xmlFilePath == null) {
      throw new Exception("String_Node_Str" + filename);
    }
    try (FileReader fr=new FileReader(xmlFilePath);BufferedReader br=new BufferedReader(fr)){
      String xml="String_Node_Str";
      String line;
      while ((line=br.readLine()) != null) {
        xml+=line.trim();
      }
      return xml;
    }
 catch (    Exception e) {
      s_logger.debug(e);
      return null;
    }
  }
 catch (  Exception e) {
    s_logger.debug(e);
    return null;
  }
}
Program: 105447
Project: 105447
Buggy source:
public static BigInteger countIp6InRange(String ip6Range){
  if (ip6Range == null) {
    return null;
  }
  String[] ips=ip6Range.split("String_Node_Str");
  String startIp=ips[0];
  String endIp=ips[0];
  if (ips.length > 1) {
    endIp=ips[1];
  }
  IPv6Address start, end;
  try {
    start=IPv6Address.fromString(startIp);
    end=IPv6Address.fromString(endIp);
  }
 catch (  IllegalArgumentException ex) {
    return null;
  }
  BigInteger startInt=convertIPv6AddressToBigInteger(start);
  BigInteger endInt=convertIPv6AddressToBigInteger(end);
  if (endInt != null) {
    if (startInt.compareTo(endInt) > 0) {
      return null;
    }
  }
  return endInt.subtract(startInt).add(BigInteger.ONE);
}

Fixed version (ground truth):
public static BigInteger countIp6InRange(String ip6Range){
  if (ip6Range == null) {
    return null;
  }
  String[] ips=ip6Range.split("String_Node_Str");
  String startIp=ips[0];
  String endIp=ips[0];
  if (ips.length > 1) {
    endIp=ips[1];
  }
  IPv6Address start, end;
  try {
    start=IPv6Address.fromString(startIp);
    end=IPv6Address.fromString(endIp);
  }
 catch (  IllegalArgumentException ex) {
    return null;
  }
  BigInteger startInt=convertIPv6AddressToBigInteger(start);
  BigInteger endInt=convertIPv6AddressToBigInteger(end);
  if (endInt != null) {
    if (startInt != null) {
      if (startInt.compareTo(endInt) > 0) {
        return null;
      }
    }
    return endInt.subtract(startInt).add(BigInteger.ONE);
  }
  return null;
}
Program: 105450
Project: 105450
Buggy source:
private boolean updateLDAP(){
  LdapConfigurationResponse response=_ldapManager.addConfiguration(hostname,port);
  ConfigurationVO cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getSearchBase());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getBindDN());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getBindPassword());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getTrustStore());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getTrustStorePassword());
  return true;
}

Fixed version (ground truth):
private boolean updateLDAP(){
  _ldapManager.addConfiguration(hostname,port);
  ConfigurationVO cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getSearchBase());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getBindDN());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getBindPassword());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getTrustStore());
  cvo=_configDao.findByName("String_Node_Str");
  _configDao.update(cvo.getName(),cvo.getCategory(),getTrustStorePassword());
  return true;
}
Program: 105452
Project: 105452
Buggy source:
@Override public void processConnect(Host agent,StartupCommand cmd,boolean forRebalance) throws ConnectionException {
  if (!(cmd instanceof StartupRoutingCommand)) {
    return;
  }
  if (s_logger.isDebugEnabled())   s_logger.debug("String_Node_Str" + agent.getId());
  _syncMgr.resetHostSyncState(agent.getId());
  if (forRebalance) {
    s_logger.debug("String_Node_Str" + this + "String_Node_Str");
    return;
  }
  if (forRebalance) {
    s_logger.debug("String_Node_Str" + this + "String_Node_Str");
    return;
  }
  Long clusterId=agent.getClusterId();
  long agentId=agent.getId();
  if (agent.getHypervisorType() == HypervisorType.XenServer) {
    ClusterVMMetaDataSyncCommand syncVMMetaDataCmd=new ClusterVMMetaDataSyncCommand(ClusterVMMetaDataSyncInterval.value(),clusterId);
    try {
      long seq_no=_agentMgr.send(agentId,new Commands(syncVMMetaDataCmd),this);
      s_logger.debug("String_Node_Str" + seq_no);
    }
 catch (    AgentUnavailableException e) {
      s_logger.fatal("String_Node_Str" + clusterId + "String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void processConnect(Host agent,StartupCommand cmd,boolean forRebalance) throws ConnectionException {
  if (!(cmd instanceof StartupRoutingCommand)) {
    return;
  }
  if (s_logger.isDebugEnabled())   s_logger.debug("String_Node_Str" + agent.getId());
  _syncMgr.resetHostSyncState(agent.getId());
  if (forRebalance) {
    s_logger.debug("String_Node_Str" + this + "String_Node_Str");
    return;
  }
  Long clusterId=agent.getClusterId();
  long agentId=agent.getId();
  if (agent.getHypervisorType() == HypervisorType.XenServer) {
    ClusterVMMetaDataSyncCommand syncVMMetaDataCmd=new ClusterVMMetaDataSyncCommand(ClusterVMMetaDataSyncInterval.value(),clusterId);
    try {
      long seq_no=_agentMgr.send(agentId,new Commands(syncVMMetaDataCmd),this);
      s_logger.debug("String_Node_Str" + seq_no);
    }
 catch (    AgentUnavailableException e) {
      s_logger.fatal("String_Node_Str" + clusterId + "String_Node_Str",e);
    }
  }
}
Program: 105453
Project: 105453
Buggy source:
@Override public StrategyPriority canHandle(Snapshot snapshot,SnapshotOperation op){
  if (SnapshotOperation.REVERT.equals(op)) {
    return StrategyPriority.CANT_HANDLE;
  }
  long volumeId=snapshot.getVolumeId();
  VolumeVO volumeVO=_volumeDao.findById(volumeId);
  long storagePoolId=volumeVO.getPoolId();
  DataStore dataStore=_dataStoreMgr.getDataStore(storagePoolId,DataStoreRole.Primary);
  Map<String,String> mapCapabilities=dataStore.getDriver().getCapabilities();
  String value=mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
  Boolean supportsStorageSystemSnapshots=new Boolean(value);
  if (supportsStorageSystemSnapshots) {
    return StrategyPriority.HIGHEST;
  }
  return StrategyPriority.CANT_HANDLE;
}

Fixed version (ground truth):
@Override public StrategyPriority canHandle(Snapshot snapshot,SnapshotOperation op){
  if (SnapshotOperation.REVERT.equals(op)) {
    return StrategyPriority.CANT_HANDLE;
  }
  long volumeId=snapshot.getVolumeId();
  VolumeVO volumeVO=_volumeDao.findById(volumeId);
  long storagePoolId=volumeVO.getPoolId();
  DataStore dataStore=_dataStoreMgr.getDataStore(storagePoolId,DataStoreRole.Primary);
  Map<String,String> mapCapabilities=dataStore.getDriver().getCapabilities();
  if (mapCapabilities != null) {
    String value=mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    Boolean supportsStorageSystemSnapshots=new Boolean(value);
    if (supportsStorageSystemSnapshots) {
      return StrategyPriority.HIGHEST;
    }
  }
  return StrategyPriority.CANT_HANDLE;
}
Program: 105454
Project: 105454
Buggy source:
@Override public Answer createVolume(CreateObjectCommand cmd){
  VolumeObjectTO volume=(VolumeObjectTO)cmd.getData();
  PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)volume.getDataStore();
  KVMStoragePool primaryPool=null;
  KVMPhysicalDisk vol=null;
  long disksize;
  try {
    primaryPool=storagePoolMgr.getStoragePool(primaryStore.getPoolType(),primaryStore.getUuid());
    disksize=volume.getSize();
    PhysicalDiskFormat format;
    if (volume.getFormat() == null) {
      format=primaryPool.getDefaultFormat();
    }
 else {
      format=PhysicalDiskFormat.valueOf(volume.getFormat().toString().toUpperCase());
    }
    vol=primaryPool.createPhysicalDisk(volume.getUuid(),format,volume.getProvisioningType(),disksize);
    VolumeObjectTO newVol=new VolumeObjectTO();
    newVol.setPath(vol.getName());
    newVol.setSize(volume.getSize());
    newVol.setFormat(ImageFormat.valueOf(format.toString().toUpperCase()));
    return new CreateObjectAnswer(newVol);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    return new CreateObjectAnswer(e.toString());
  }
}

Fixed version (ground truth):
@Override public Answer createVolume(CreateObjectCommand cmd){
  VolumeObjectTO volume=(VolumeObjectTO)cmd.getData();
  PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)volume.getDataStore();
  KVMStoragePool primaryPool=null;
  KVMPhysicalDisk vol=null;
  long disksize;
  try {
    primaryPool=storagePoolMgr.getStoragePool(primaryStore.getPoolType(),primaryStore.getUuid());
    disksize=volume.getSize();
    PhysicalDiskFormat format;
    if (volume.getFormat() == null) {
      format=primaryPool.getDefaultFormat();
    }
 else {
      format=PhysicalDiskFormat.valueOf(volume.getFormat().toString().toUpperCase());
    }
    vol=primaryPool.createPhysicalDisk(volume.getUuid(),format,volume.getProvisioningType(),disksize);
    VolumeObjectTO newVol=new VolumeObjectTO();
    if (vol != null) {
      newVol.setPath(vol.getName());
    }
    newVol.setSize(volume.getSize());
    newVol.setFormat(ImageFormat.valueOf(format.toString().toUpperCase()));
    return new CreateObjectAnswer(newVol);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    return new CreateObjectAnswer(e.toString());
  }
}
Program: 105456
Project: 105456
Buggy source:
@Override public KVMPhysicalDisk getPhysicalDisk(String volumeUuid,KVMStoragePool pool){
  Connect conn;
  StoragePool virtPool=null;
  try {
    conn=LibvirtConnection.getConnection();
    virtPool=conn.storagePoolLookupByName("String_Node_Str" + volumeUuid);
  }
 catch (  LibvirtException e1) {
    throw new CloudRuntimeException(e1.toString());
  }
  LibvirtStorageVolumeDef.volFormat libvirtformat=null;
  String volPath=null;
  String volName=null;
  long volAllocation=0;
  long volCapacity=0;
  StorageVol vol=getVolume(virtPool,volumeUuid);
  try {
    if (vol == null) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.QCOW2;
      StoragePoolInfo poolinfo=virtPool.getInfo();
      volCapacity=poolinfo.available;
      LibvirtStorageVolumeDef volDef=new LibvirtStorageVolumeDef(volumeUuid,volCapacity,libvirtformat,null,null);
      s_logger.debug(volDef.toString());
      vol=virtPool.storageVolCreateXML(volDef.toString(),0);
      volPath=vol.getPath();
      volName=vol.getName();
      volAllocation=vol.getInfo().allocation;
      volCapacity=vol.getInfo().capacity;
    }
    KVMPhysicalDisk disk=new KVMPhysicalDisk(vol.getPath(),volumeUuid,pool);
    disk.setFormat(PhysicalDiskFormat.QCOW2);
    disk.setSize(vol.getInfo().allocation);
    disk.setVirtualSize(vol.getInfo().capacity);
    return disk;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}

Fixed version (ground truth):
@Override public KVMPhysicalDisk getPhysicalDisk(String volumeUuid,KVMStoragePool pool){
  Connect conn;
  StoragePool virtPool=null;
  try {
    conn=LibvirtConnection.getConnection();
    virtPool=conn.storagePoolLookupByName("String_Node_Str" + volumeUuid);
  }
 catch (  LibvirtException e1) {
    throw new CloudRuntimeException(e1.toString());
  }
  LibvirtStorageVolumeDef.volFormat libvirtformat=null;
  long volCapacity=0;
  StorageVol vol=getVolume(virtPool,volumeUuid);
  try {
    if (vol == null) {
      libvirtformat=LibvirtStorageVolumeDef.volFormat.QCOW2;
      StoragePoolInfo poolinfo=virtPool.getInfo();
      volCapacity=poolinfo.available;
      LibvirtStorageVolumeDef volDef=new LibvirtStorageVolumeDef(volumeUuid,volCapacity,libvirtformat,null,null);
      s_logger.debug(volDef.toString());
      vol=virtPool.storageVolCreateXML(volDef.toString(),0);
    }
    KVMPhysicalDisk disk=new KVMPhysicalDisk(vol.getPath(),volumeUuid,pool);
    disk.setFormat(PhysicalDiskFormat.QCOW2);
    disk.setSize(vol.getInfo().allocation);
    disk.setVirtualSize(vol.getInfo().capacity);
    return disk;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}
Program: 105459
Project: 105459
Buggy source:
@Override public CiscoNexusVSMDeviceVO doInTransaction(TransactionStatus status){
  CiscoNexusVSMDeviceVO vsm=null;
  if (_vsmDao.getVSMbyIpaddress(vsmIp) == null) {
    vsm=new CiscoNexusVSMDeviceVO(vsmIp,vsmUser,vsmPassword);
    vsm=_vsmDao.persist(vsm);
  }
  vsm=_vsmDao.getVSMbyIpaddress(vsmIp);
  if (vsm != null) {
    ClusterVSMMapVO connectorObj=new ClusterVSMMapVO(clusterId,vsm.getId());
    _clusterVSMDao.persist(connectorObj);
  }
  return vsm;
}

Fixed version (ground truth):
@Override public CiscoNexusVSMDeviceVO doInTransaction(TransactionStatus status){
  CiscoNexusVSMDeviceVO vsm=null;
  if (_vsmDao.getVSMbyIpaddress(vsmIp) == null) {
    vsm=new CiscoNexusVSMDeviceVO(vsmIp,vsmUser,vsmPassword);
    _vsmDao.persist(vsm);
  }
  vsm=_vsmDao.getVSMbyIpaddress(vsmIp);
  if (vsm != null) {
    ClusterVSMMapVO connectorObj=new ClusterVSMMapVO(clusterId,vsm.getId());
    _clusterVSMDao.persist(connectorObj);
  }
  return vsm;
}
Program: 105460
Project: 105460
Buggy source:
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_SNAPSHOT_CREATE,eventDescription="String_Node_Str",async=true) public Snapshot createSnapshot(Long volumeId,Long policyId,Long snapshotId,Account snapshotOwner){
  VolumeInfo volume=volFactory.getVolume(volumeId);
  if (volume == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Ready) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  boolean backedUp=false;
  _accountMgr.checkAccess(CallContext.current().getCallingAccount(),null,true,volume);
  SnapshotInfo snapshot=snapshotFactory.getSnapshot(snapshotId,DataStoreRole.Primary);
  try {
    postCreateSnapshot(volumeId,snapshot.getId(),policyId);
    SnapshotVO freshSnapshot=_snapshotDao.findById(snapshot.getId());
    if ((freshSnapshot != null) && backedUp) {
      UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE,snapshot.getAccountId(),snapshot.getDataCenterId(),snapshotId,snapshot.getName(),null,null,volume.getSize(),snapshot.getClass().getName(),snapshot.getUuid());
    }
    _resourceLimitMgr.incrementResourceCount(snapshotOwner.getId(),ResourceType.snapshot);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
  return snapshot;
}

Fixed version (ground truth):
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_SNAPSHOT_CREATE,eventDescription="String_Node_Str",async=true) public Snapshot createSnapshot(Long volumeId,Long policyId,Long snapshotId,Account snapshotOwner){
  VolumeInfo volume=volFactory.getVolume(volumeId);
  if (volume == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Ready) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  _accountMgr.checkAccess(CallContext.current().getCallingAccount(),null,true,volume);
  SnapshotInfo snapshot=snapshotFactory.getSnapshot(snapshotId,DataStoreRole.Primary);
  if (snapshot != null) {
    s_logger.debug("String_Node_Str");
    throw new CloudRuntimeException("String_Node_Str");
  }
  try {
    postCreateSnapshot(volumeId,snapshot.getId(),policyId);
    SnapshotVO freshSnapshot=_snapshotDao.findById(snapshot.getId());
    if (freshSnapshot != null) {
      UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE,snapshot.getAccountId(),snapshot.getDataCenterId(),snapshotId,snapshot.getName(),null,null,volume.getSize(),snapshot.getClass().getName(),snapshot.getUuid());
    }
    _resourceLimitMgr.incrementResourceCount(snapshotOwner.getId(),ResourceType.snapshot);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
  return snapshot;
}
Program: 105462
Project: 105462
Buggy source:
@Override public boolean upgradeVirtualMachine(Long vmId,Long newServiceOfferingId,Map<String,String> customParameters) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
  VMInstanceVO vmInstance=_vmInstanceDao.findById(vmId);
  if (vmInstance != null) {
    List<VMSnapshotVO> vmSnapshots=_vmSnapshotDao.findByVm(vmId);
    if (vmSnapshots.size() > 0) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  if (vmInstance.getState().equals(State.Stopped)) {
    upgradeStoppedVirtualMachine(vmId,newServiceOfferingId,customParameters);
    return true;
  }
  if (vmInstance.getState().equals(State.Running)) {
    return upgradeRunningVirtualMachine(vmId,newServiceOfferingId,customParameters);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean upgradeVirtualMachine(Long vmId,Long newServiceOfferingId,Map<String,String> customParameters) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
  VMInstanceVO vmInstance=_vmInstanceDao.findById(vmId);
  if (vmInstance != null) {
    List<VMSnapshotVO> vmSnapshots=_vmSnapshotDao.findByVm(vmId);
    if (vmSnapshots.size() > 0) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    if (vmInstance.getState().equals(State.Stopped)) {
      upgradeStoppedVirtualMachine(vmId,newServiceOfferingId,customParameters);
      return true;
    }
    if (vmInstance.getState().equals(State.Running)) {
      return upgradeRunningVirtualMachine(vmId,newServiceOfferingId,customParameters);
    }
  }
  return false;
}
Program: 105464
Project: 105464
Buggy source:
@Override public boolean destroySecStorageVm(long vmId){
  SecondaryStorageVmVO ssvm=_secStorageVmDao.findById(vmId);
  try {
    _itMgr.expunge(ssvm.getUuid());
    _secStorageVmDao.remove(ssvm.getId());
    HostVO host=_hostDao.findByTypeNameAndZoneId(ssvm.getDataCenterId(),ssvm.getHostName(),Host.Type.SecondaryStorageVM);
    if (host != null) {
      s_logger.debug("String_Node_Str" + vmId);
      _hostDao.remove(host.getId());
    }
    _tmplStoreDao.expireDnldUrlsForZone(host.getDataCenterId());
    _volumeStoreDao.expireDnldUrlsForZone(host.getDataCenterId());
    return true;
  }
 catch (  ResourceUnavailableException e) {
    s_logger.warn("String_Node_Str" + ssvm,e);
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean destroySecStorageVm(long vmId){
  SecondaryStorageVmVO ssvm=_secStorageVmDao.findById(vmId);
  try {
    _itMgr.expunge(ssvm.getUuid());
    _secStorageVmDao.remove(ssvm.getId());
    HostVO host=_hostDao.findByTypeNameAndZoneId(ssvm.getDataCenterId(),ssvm.getHostName(),Host.Type.SecondaryStorageVM);
    if (host != null) {
      s_logger.debug("String_Node_Str" + vmId);
      _hostDao.remove(host.getId());
      _tmplStoreDao.expireDnldUrlsForZone(host.getDataCenterId());
      _volumeStoreDao.expireDnldUrlsForZone(host.getDataCenterId());
      return true;
    }
    return false;
  }
 catch (  ResourceUnavailableException e) {
    s_logger.warn("String_Node_Str" + ssvm,e);
    return false;
  }
}
Program: 105465
Project: 105465
Buggy source:
static Set<Class<?>> getFromJARFile(String jar,String packageName) throws IOException, ClassNotFoundException {
  Set<Class<?>> classes=new HashSet<Class<?>>();
  JarInputStream jarFile=new JarInputStream(new FileInputStream(jar));
  JarEntry jarEntry;
  do {
    jarEntry=jarFile.getNextJarEntry();
    if (jarEntry != null) {
      String className=jarEntry.getName();
      if (className.endsWith("String_Node_Str")) {
        className=stripFilenameExtension(className);
        if (className.startsWith(packageName)) {
          try {
            Class<?> clz=Class.forName(className.replace('/','.'));
            classes.add(clz);
          }
 catch (          ClassNotFoundException e) {
          }
catch (          NoClassDefFoundError e) {
          }
        }
      }
      IOUtils.closeQuietly(jarFile);
    }
  }
 while (jarEntry != null);
  IOUtils.closeQuietly(jarFile);
  return classes;
}

Fixed version (ground truth):
static Set<Class<?>> getFromJARFile(String jar,String packageName) throws IOException, ClassNotFoundException {
  Set<Class<?>> classes=new HashSet<Class<?>>();
  JarInputStream jarFile=new JarInputStream(new FileInputStream(jar));
  JarEntry jarEntry;
  do {
    jarEntry=jarFile.getNextJarEntry();
    if (jarEntry != null) {
      String className=jarEntry.getName();
      if (className.endsWith("String_Node_Str")) {
        className=stripFilenameExtension(className);
        if (className.startsWith(packageName)) {
          try {
            Class<?> clz=Class.forName(className.replace('/','.'));
            classes.add(clz);
          }
 catch (          ClassNotFoundException|NoClassDefFoundError e) {
            s_logger.warn("String_Node_Str",e);
          }
        }
      }
    }
  }
 while (jarEntry != null);
  IOUtils.closeQuietly(jarFile);
  return classes;
}
Program: 105480
Project: 105480
Buggy source:
public void processStartupAnswer(Answer answer,Response response,Link link){
  boolean cancelled=false;
synchronized (this) {
    if (_startup != null) {
      _startup.cancel();
      _startup=null;
    }
 else {
      cancelled=true;
    }
  }
  final StartupAnswer startup=(StartupAnswer)answer;
  if (!startup.getResult()) {
    s_logger.error("String_Node_Str" + answer.getDetails());
    System.exit(1);
  }
  if (cancelled) {
    s_logger.warn("String_Node_Str");
    return;
  }
  s_logger.info("String_Node_Str" + startup.getHostId());
  setId(startup.getHostId());
  _pingInterval=startup.getPingInterval() * 1000;
  setLastPingResponseTime();
  scheduleWatch(link,response,_pingInterval,_pingInterval);
  _ugentTaskPool.setKeepAliveTime(2 * _pingInterval,TimeUnit.MILLISECONDS);
  s_logger.info("String_Node_Str" + getId());
}

Fixed version (ground truth):
public void processStartupAnswer(Answer answer,Response response,Link link){
  boolean cancelled=false;
synchronized (this) {
    if (_startup != null) {
      _startup.cancel();
      _startup=null;
    }
 else {
      cancelled=true;
    }
  }
  final StartupAnswer startup=(StartupAnswer)answer;
  if (!startup.getResult()) {
    s_logger.error("String_Node_Str" + answer.getDetails());
    System.exit(1);
  }
  if (cancelled) {
    s_logger.warn("String_Node_Str");
    return;
  }
  s_logger.info("String_Node_Str" + startup.getHostId());
  setId(startup.getHostId());
  _pingInterval=(long)startup.getPingInterval() * 1000;
  setLastPingResponseTime();
  scheduleWatch(link,response,_pingInterval,_pingInterval);
  _ugentTaskPool.setKeepAliveTime(2 * _pingInterval,TimeUnit.MILLISECONDS);
  s_logger.info("String_Node_Str" + getId());
}
Program: 105481
Project: 105481
Buggy source:
private VirtualMachineGuru getVmGuru(VirtualMachine vm){
  return _vmGurus.get(vm.getType());
}

Fixed version (ground truth):
private VirtualMachineGuru getVmGuru(VirtualMachine vm){
  if (vm != null)   return _vmGurus.get(vm.getType());
  return null;
}
Program: 105482
Project: 105482
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  Map<String,String> configs=_configDao.getConfiguration(null,params);
  String globalStorageOverprovisioningFactor=configs.get("String_Node_Str");
  _storageOverprovisioningFactor=new BigDecimal(NumbersUtil.parseFloat(globalStorageOverprovisioningFactor,2.0f));
  _extraBytesPerVolume=0;
  _rand=new Random(System.currentTimeMillis());
  _dontMatter=Boolean.parseBoolean(configs.get("String_Node_Str"));
  String allocationAlgorithm=configs.get("String_Node_Str");
  if (allocationAlgorithm != null) {
    _allocationAlgorithm=allocationAlgorithm;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  if (_configDao != null) {
    Map<String,String> configs=_configDao.getConfiguration(null,params);
    String globalStorageOverprovisioningFactor=configs.get("String_Node_Str");
    _storageOverprovisioningFactor=new BigDecimal(NumbersUtil.parseFloat(globalStorageOverprovisioningFactor,2.0f));
    _extraBytesPerVolume=0;
    _rand=new Random(System.currentTimeMillis());
    _dontMatter=Boolean.parseBoolean(configs.get("String_Node_Str"));
    String allocationAlgorithm=configs.get("String_Node_Str");
    if (allocationAlgorithm != null) {
      _allocationAlgorithm=allocationAlgorithm;
    }
    return true;
  }
  return false;
}
Program: 105483
Project: 105483
Buggy source:
@Override public void completeCall(Object returnObject){
  assert(_sourceAddress != null);
  assert(_targetAddress != null);
  RpcCallResponsePdu pdu=new RpcCallResponsePdu();
  pdu.setCommand(_requestPdu.getCommand());
  pdu.setRequestTag(_requestPdu.getRequestTag());
  pdu.setRequestStartTick(_requestPdu.getRequestStartTick());
  pdu.setRequestStartTick(RpcCallResponsePdu.RESULT_SUCCESSFUL);
  if (returnObject != null) {
    assert(_rpcProvider.getMessageSerializer() != null);
    pdu.setSerializedResult(_rpcProvider.getMessageSerializer().serializeTo(returnObject.getClass(),returnObject));
  }
  _rpcProvider.sendRpcPdu(_targetAddress,_sourceAddress,_rpcProvider.getMessageSerializer().serializeTo(RpcCallResponsePdu.class,pdu));
}

Fixed version (ground truth):
@Override public void completeCall(Object returnObject){
  assert(_sourceAddress != null);
  assert(_targetAddress != null);
  RpcCallResponsePdu pdu=new RpcCallResponsePdu();
  pdu.setCommand(_requestPdu.getCommand());
  pdu.setRequestTag(_requestPdu.getRequestTag());
  pdu.setRequestStartTick(_requestPdu.getRequestStartTick());
  pdu.setRequestStartTick(RpcCallResponsePdu.RESULT_SUCCESSFUL);
  if (returnObject != null) {
    assert(_rpcProvider.getMessageSerializer() != null);
    pdu.setSerializedResult(_rpcProvider.getMessageSerializer().serializeTo(returnObject.getClass(),returnObject));
  }
  _rpcProvider.sendRpcPdu(_sourceAddress,_targetAddress,_rpcProvider.getMessageSerializer().serializeTo(RpcCallResponsePdu.class,pdu));
}
Program: 105486
Project: 105486
Buggy source:
@Override public Answer createTemplateFromSnapshot(CopyCommand cmd){
  SnapshotObjectTO snapshot=(SnapshotObjectTO)cmd.getSrcTO();
  TemplateObjectTO template=(TemplateObjectTO)cmd.getDestTO();
  DataStoreTO imageStore=template.getDataStore();
  String details;
  String uniqeName=UUID.randomUUID().toString();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    if (!(imageStore instanceof NfsTO)) {
      return new CopyCmdAnswer("String_Node_Str");
    }
    NfsTO nfsSvr=(NfsTO)imageStore;
    Ternary<String,Long,Long> result=createTemplateFromSnapshot(template.getPath(),uniqeName,nfsSvr.getUrl(),snapshot.getPath(),template.getId(),cmd.getWait() * 1000);
    TemplateObjectTO newTemplate=new TemplateObjectTO();
    newTemplate.setPath(result.first());
    newTemplate.setPhysicalSize(result.second());
    newTemplate.setSize(result.third());
    newTemplate.setFormat(ImageFormat.OVA);
    newTemplate.setName(uniqeName);
    return new CopyCmdAnswer(newTemplate);
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    s_logger.error("String_Node_Str",e);
    details="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
    return new CopyCmdAnswer(details);
  }
}

Fixed version (ground truth):
@Override public Answer createTemplateFromSnapshot(CopyCommand cmd){
  SnapshotObjectTO snapshot=(SnapshotObjectTO)cmd.getSrcTO();
  TemplateObjectTO template=(TemplateObjectTO)cmd.getDestTO();
  DataStoreTO imageStore=template.getDataStore();
  String details;
  String uniqeName=UUID.randomUUID().toString();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    if (!(imageStore instanceof NfsTO)) {
      return new CopyCmdAnswer("String_Node_Str");
    }
    NfsTO nfsSvr=(NfsTO)imageStore;
    Ternary<String,Long,Long> result=createTemplateFromSnapshot(template.getPath(),uniqeName,nfsSvr.getUrl(),snapshot.getPath(),template.getId(),(long)cmd.getWait() * 1000);
    TemplateObjectTO newTemplate=new TemplateObjectTO();
    newTemplate.setPath(result.first());
    newTemplate.setPhysicalSize(result.second());
    newTemplate.setSize(result.third());
    newTemplate.setFormat(ImageFormat.OVA);
    newTemplate.setName(uniqeName);
    return new CopyCmdAnswer(newTemplate);
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    s_logger.error("String_Node_Str",e);
    details="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
    return new CopyCmdAnswer(details);
  }
}
Program: 105489
Project: 105489
Buggy source:
protected VDI cloudVDIcopy(Connection conn,VDI vdi,SR sr,int wait) throws Exception {
  Task task=null;
  if (wait == 0) {
    wait=2 * 60 * 60;
  }
  try {
    task=vdi.copyAsync(conn,sr);
    waitForTask(conn,task,1000,wait * 1000);
    checkForSuccess(conn,task);
    VDI dvdi=Types.toVDI(task,conn);
    return dvdi;
  }
  finally {
    if (task != null) {
      try {
        task.destroy(conn);
      }
 catch (      Exception e) {
        s_logger.debug("String_Node_Str" + task.toString() + "String_Node_Str"+ _host.uuid+ "String_Node_Str"+ e.toString());
      }
    }
  }
}

Fixed version (ground truth):
protected VDI cloudVDIcopy(Connection conn,VDI vdi,SR sr,int wait) throws Exception {
  Task task=null;
  if (wait == 0) {
    wait=2 * 60 * 60;
  }
  try {
    task=vdi.copyAsync(conn,sr);
    waitForTask(conn,task,1000,(long)wait * 1000);
    checkForSuccess(conn,task);
    VDI dvdi=Types.toVDI(task,conn);
    return dvdi;
  }
  finally {
    if (task != null) {
      try {
        task.destroy(conn);
      }
 catch (      Exception e) {
        s_logger.debug("String_Node_Str" + task.toString() + "String_Node_Str"+ _host.uuid+ "String_Node_Str"+ e.toString());
      }
    }
  }
}
Program: 105491
Project: 105491
Buggy source:
public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig,int cpuCount,int cpuSpeedMHz,int cpuReservedMhz,int memoryMB,int memoryReserveMB,String guestOsIdentifier,boolean limitCpuUse){
  vmConfig.setMemoryMB((long)memoryMB);
  vmConfig.setNumCPUs(cpuCount);
  ResourceAllocationInfo cpuInfo=new ResourceAllocationInfo();
  if (limitCpuUse) {
    cpuInfo.setLimit((long)(cpuSpeedMHz * cpuCount));
  }
 else {
    cpuInfo.setLimit(-1L);
  }
  cpuInfo.setReservation((long)cpuReservedMhz);
  vmConfig.setCpuAllocation(cpuInfo);
  if (cpuSpeedMHz != cpuReservedMhz) {
    vmConfig.setCpuHotAddEnabled(true);
  }
  if (memoryMB != memoryReserveMB) {
    vmConfig.setMemoryHotAddEnabled(true);
  }
  ResourceAllocationInfo memInfo=new ResourceAllocationInfo();
  memInfo.setLimit((long)memoryMB);
  memInfo.setReservation((long)memoryReserveMB);
  vmConfig.setMemoryAllocation(memInfo);
  vmConfig.setGuestId(guestOsIdentifier);
}

Fixed version (ground truth):
public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig,int cpuCount,int cpuSpeedMHz,int cpuReservedMhz,int memoryMB,int memoryReserveMB,String guestOsIdentifier,boolean limitCpuUse){
  vmConfig.setMemoryMB((long)memoryMB);
  vmConfig.setNumCPUs(cpuCount);
  ResourceAllocationInfo cpuInfo=new ResourceAllocationInfo();
  if (limitCpuUse) {
    cpuInfo.setLimit(((long)cpuSpeedMHz * cpuCount));
  }
 else {
    cpuInfo.setLimit(-1L);
  }
  cpuInfo.setReservation((long)cpuReservedMhz);
  vmConfig.setCpuAllocation(cpuInfo);
  if (cpuSpeedMHz != cpuReservedMhz) {
    vmConfig.setCpuHotAddEnabled(true);
  }
  if (memoryMB != memoryReserveMB) {
    vmConfig.setMemoryHotAddEnabled(true);
  }
  ResourceAllocationInfo memInfo=new ResourceAllocationInfo();
  memInfo.setLimit((long)memoryMB);
  memInfo.setReservation((long)memoryReserveMB);
  vmConfig.setMemoryAllocation(memInfo);
  vmConfig.setGuestId(guestOsIdentifier);
}
Program: 105492
Project: 105492
Buggy source:
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setCluster(_cluster);
  cmd.setPoolSync(false);
  Pool pool;
  try {
    pool=Pool.getByUuid(conn,_host.pool);
    Pool.Record poolr=pool.getRecord(conn);
    Host.Record hostr=poolr.master.getRecord(conn);
  }
 catch (  Throwable e) {
    s_logger.warn("String_Node_Str");
  }
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}

Fixed version (ground truth):
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setCluster(_cluster);
  cmd.setPoolSync(false);
  try {
    Pool pool=Pool.getByUuid(conn,_host.pool);
    Pool.Record poolr=pool.getRecord(conn);
    poolr.master.getRecord(conn);
  }
 catch (  Throwable e) {
    s_logger.warn("String_Node_Str");
  }
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}
Program: 105494
Project: 105494
Buggy source:
void validateSourceNatServiceCapablities(Map<Capability,String> sourceNatServiceCapabilityMap){
  if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) {
    if (sourceNatServiceCapabilityMap.keySet().size() > 2) {
      throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
    }
    for (    Capability capability : sourceNatServiceCapabilityMap.keySet()) {
      String value=sourceNatServiceCapabilityMap.get(capability);
      if (capability == Capability.SupportedSourceNatTypes) {
        boolean perAccount=value.contains("String_Node_Str");
        boolean perZone=value.contains("String_Node_Str");
        if ((perAccount && perZone) || (!perAccount && !perZone)) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName());
        }
      }
 else       if (capability == Capability.RedundantRouter) {
        boolean enabled=value.contains("String_Node_Str");
        boolean disabled=value.contains("String_Node_Str");
        if (!enabled && !disabled) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.RedundantRouter.getName());
        }
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
void validateSourceNatServiceCapablities(Map<Capability,String> sourceNatServiceCapabilityMap){
  if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) {
    if (sourceNatServiceCapabilityMap.keySet().size() > 2) {
      throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
    }
    for (    Map.Entry<Capability,String> srcNatPair : sourceNatServiceCapabilityMap.entrySet()) {
      Capability capability=srcNatPair.getKey();
      String value=srcNatPair.getValue();
      if (capability == Capability.SupportedSourceNatTypes) {
        boolean perAccount=value.contains("String_Node_Str");
        boolean perZone=value.contains("String_Node_Str");
        if ((perAccount && perZone) || (!perAccount && !perZone)) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName());
        }
      }
 else       if (capability == Capability.RedundantRouter) {
        boolean enabled=value.contains("String_Node_Str");
        boolean disabled=value.contains("String_Node_Str");
        if (!enabled && !disabled) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.RedundantRouter.getName());
        }
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
      }
    }
  }
}
Program: 105495
Project: 105495
Buggy source:
String createSyslogMessage(){
  StringBuilder message=new StringBuilder();
  message.append(severityOfAlert(alertType)).append(MESSAGE_DELIMITER_STRING);
  InetAddress ip;
  try {
    ip=InetAddress.getLocalHost();
  }
 catch (  UnknownHostException e) {
    ip=null;
  }
  if (ip != null) {
    message.append(ip.getHostName()).append(MESSAGE_DELIMITER_STRING);
  }
 else {
    message.append("String_Node_Str" + MESSAGE_DELIMITER_STRING);
  }
  if (alertType >= 0) {
    message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(alertsMap.get(alertType)).append(MESSAGE_DELIMITER_STRING);
    if (dataCenterId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(dataCenterId).append(MESSAGE_DELIMITER_STRING);
    }
    if (podId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(podId).append(MESSAGE_DELIMITER_STRING);
    }
    if (clusterId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(clusterId).append(MESSAGE_DELIMITER_STRING);
    }
    if (sysMessage != null) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(sysMessage);
    }
 else {
      errorHandler.error("String_Node_Str");
    }
  }
 else {
    errorHandler.error("String_Node_Str");
  }
  return message.toString();
}

Fixed version (ground truth):
String createSyslogMessage(){
  StringBuilder message=new StringBuilder();
  message.append(severityOfAlert(alertType)).append(MESSAGE_DELIMITER_STRING);
  InetAddress ip;
  try {
    ip=InetAddress.getLocalHost();
  }
 catch (  UnknownHostException e) {
    ip=null;
  }
  if (ip != null) {
    message.append(ip.getHostName()).append(MESSAGE_DELIMITER_STRING);
  }
 else {
    message.append("String_Node_Str" + MESSAGE_DELIMITER_STRING);
  }
  if (alertType >= 0) {
    message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(alertsMap.containsKey(alertType) ? alertsMap.get(alertType) : "String_Node_Str").append(MESSAGE_DELIMITER_STRING);
    if (dataCenterId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(dataCenterId).append(MESSAGE_DELIMITER_STRING);
    }
    if (podId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(podId).append(MESSAGE_DELIMITER_STRING);
    }
    if (clusterId != 0) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(clusterId).append(MESSAGE_DELIMITER_STRING);
    }
    if (sysMessage != null) {
      message.append("String_Node_Str").append(_keyValueDelimiter).append("String_Node_Str").append(sysMessage);
    }
 else {
      errorHandler.error("String_Node_Str");
    }
  }
 else {
    errorHandler.error("String_Node_Str");
  }
  return message.toString();
}
Program: 105496
Project: 105496
Buggy source:
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setCluster(_cluster);
  cmd.setPoolSync(false);
  Pool pool;
  try {
    pool=Pool.getByUuid(conn,_host.pool);
    Pool.Record poolr=pool.getRecord(conn);
    Host.Record hostr=poolr.master.getRecord(conn);
  }
 catch (  Throwable e) {
    s_logger.warn("String_Node_Str");
  }
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}

Fixed version (ground truth):
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setCluster(_cluster);
  cmd.setPoolSync(false);
  try {
    Pool pool=Pool.getByUuid(conn,_host.pool);
    Pool.Record poolr=pool.getRecord(conn);
    poolr.master.getRecord(conn);
  }
 catch (  Throwable e) {
    s_logger.warn("String_Node_Str");
  }
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}
Program: 105498
Project: 105498
Buggy source:
void validateSourceNatServiceCapablities(Map<Capability,String> sourceNatServiceCapabilityMap){
  if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) {
    if (sourceNatServiceCapabilityMap.keySet().size() > 2) {
      throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
    }
    for (    Capability capability : sourceNatServiceCapabilityMap.keySet()) {
      String value=sourceNatServiceCapabilityMap.get(capability);
      if (capability == Capability.SupportedSourceNatTypes) {
        boolean perAccount=value.contains("String_Node_Str");
        boolean perZone=value.contains("String_Node_Str");
        if ((perAccount && perZone) || (!perAccount && !perZone)) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName());
        }
      }
 else       if (capability == Capability.RedundantRouter) {
        boolean enabled=value.contains("String_Node_Str");
        boolean disabled=value.contains("String_Node_Str");
        if (!enabled && !disabled) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.RedundantRouter.getName());
        }
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
void validateSourceNatServiceCapablities(Map<Capability,String> sourceNatServiceCapabilityMap){
  if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) {
    if (sourceNatServiceCapabilityMap.keySet().size() > 2) {
      throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
    }
    for (    Map.Entry<Capability,String> srcNatPair : sourceNatServiceCapabilityMap.entrySet()) {
      Capability capability=srcNatPair.getKey();
      String value=srcNatPair.getValue();
      if (capability == Capability.SupportedSourceNatTypes) {
        boolean perAccount=value.contains("String_Node_Str");
        boolean perZone=value.contains("String_Node_Str");
        if ((perAccount && perZone) || (!perAccount && !perZone)) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName());
        }
      }
 else       if (capability == Capability.RedundantRouter) {
        boolean enabled=value.contains("String_Node_Str");
        boolean disabled=value.contains("String_Node_Str");
        if (!enabled && !disabled) {
          throw new InvalidParameterValueException("String_Node_Str" + Capability.RedundantRouter.getName());
        }
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str" + Capability.SupportedSourceNatTypes.getName() + "String_Node_Str"+ Capability.RedundantRouter+ "String_Node_Str");
      }
    }
  }
}