nus-yam/ex-repair huggingface dataset:
Program: 106276
Project: 106276
Buggy source:
@Override public Set<Long> getAvailableIps(Network network,String requestedIp){
  String[] cidr=network.getCidr().split("String_Node_Str");
  List<String> ips=_nicDao.listIpAddressInNetwork(network.getId());
  List<String> secondaryIps=_nicSecondaryIpDao.listSecondaryIpAddressInNetwork(network.getId());
  ips.addAll(secondaryIps);
  Set<Long> allPossibleIps=NetUtils.getAllIpsFromCidr(cidr[0],Integer.parseInt(cidr[1]));
  Set<Long> usedIps=new TreeSet<Long>();
  for (  String ip : ips) {
    if (requestedIp != null && requestedIp.equals(ip)) {
      s_logger.warn("String_Node_Str" + requestedIp + "String_Node_Str"+ network);
      return null;
    }
    usedIps.add(NetUtils.ip2Long(ip));
  }
  if (usedIps.size() != 0) {
    allPossibleIps.removeAll(usedIps);
  }
  String gateway=network.getGateway();
  if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))   allPossibleIps.remove(NetUtils.ip2Long(gateway));
  return allPossibleIps;
}

Fixed version (ground truth):
@Override public Set<Long> getAvailableIps(Network network,String requestedIp){
  String[] cidr=network.getCidr().split("String_Node_Str");
  List<String> ips=_nicDao.listIpAddressInNetwork(network.getId());
  List<String> secondaryIps=_nicSecondaryIpDao.listSecondaryIpAddressInNetwork(network.getId());
  ips.addAll(secondaryIps);
  Set<Long> usedIps=new TreeSet<Long>();
  for (  String ip : ips) {
    if (requestedIp != null && requestedIp.equals(ip)) {
      s_logger.warn("String_Node_Str" + requestedIp + "String_Node_Str"+ network);
      return null;
    }
    usedIps.add(NetUtils.ip2Long(ip));
  }
  Set<Long> allPossibleIps=NetUtils.getAllIpsFromCidr(cidr[0],Integer.parseInt(cidr[1]),usedIps);
  String gateway=network.getGateway();
  if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))   allPossibleIps.remove(NetUtils.ip2Long(gateway));
  return allPossibleIps;
}
Program: 106277
Project: 106277
Buggy source:
protected Set<Long> getAvailableIps(Network network,String requestedIp){
  String[] cidr=network.getCidr().split("String_Node_Str");
  List<String> ips=_nicDao.listIpAddressInNetwork(network.getId());
  Set<Long> allPossibleIps=NetUtils.getAllIpsFromCidr(cidr[0],Integer.parseInt(cidr[1]));
  Set<Long> usedIps=new TreeSet<Long>();
  for (  String ip : ips) {
    if (requestedIp != null && requestedIp.equals(ip)) {
      s_logger.warn("String_Node_Str" + requestedIp + "String_Node_Str"+ network);
      return null;
    }
    usedIps.add(NetUtils.ip2Long(ip));
  }
  if (usedIps.size() != 0) {
    allPossibleIps.removeAll(usedIps);
  }
  String gateway=network.getGateway();
  if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))   allPossibleIps.remove(NetUtils.ip2Long(gateway));
  return allPossibleIps;
}

Fixed version (ground truth):
protected Set<Long> getAvailableIps(Network network,String requestedIp){
  String[] cidr=network.getCidr().split("String_Node_Str");
  List<String> ips=_nicDao.listIpAddressInNetwork(network.getId());
  Set<Long> usedIps=new TreeSet<Long>();
  for (  String ip : ips) {
    if (requestedIp != null && requestedIp.equals(ip)) {
      s_logger.warn("String_Node_Str" + requestedIp + "String_Node_Str"+ network);
      return null;
    }
    usedIps.add(NetUtils.ip2Long(ip));
  }
  Set<Long> allPossibleIps=NetUtils.getAllIpsFromCidr(cidr[0],Integer.parseInt(cidr[1]),usedIps);
  String gateway=network.getGateway();
  if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))   allPossibleIps.remove(NetUtils.ip2Long(gateway));
  return allPossibleIps;
}
Program: 106278
Project: 106278
Buggy source:
public static Set<Long> getAllIpsFromCidr(String cidr,long size){
}

Fixed version (ground truth):
public static Set<Long> getAllIpsFromCidr(String cidr,long size,Set<Long> usedIps){
}
Program: 106281
Project: 106281
Buggy source:
public ImageStoreVO createImageStore(Map<String,Object> params,Map<String,String> details){
  ImageStoreVO store=imageStoreDao.findByName((String)params.get("String_Node_Str"));
  if (store != null) {
    return store;
  }
  store=new ImageStoreVO();
  store.setName((String)params.get("String_Node_Str"));
  store.setProtocol((String)params.get("String_Node_Str"));
  store.setProviderName((String)params.get("String_Node_Str"));
  store.setScope((ScopeType)params.get("String_Node_Str"));
  store.setUuid((String)params.get("String_Node_Str"));
  store.setUrl((String)params.get("String_Node_Str"));
  store.setRole(DataStoreRole.getRole((String)params.get("String_Node_Str")));
  store=imageStoreDao.persist(store);
  if (details != null) {
    Iterator<String> keyIter=details.keySet().iterator();
    while (keyIter.hasNext()) {
      String key=keyIter.next();
      ImageStoreDetailVO detail=new ImageStoreDetailVO();
      detail.setStoreId(store.getId());
      detail.setName(key);
      detail.setValue(details.get(key));
      imageStoreDetailsDao.persist(detail);
    }
  }
  return store;
}

Fixed version (ground truth):
public ImageStoreVO createImageStore(Map<String,Object> params,Map<String,String> details){
  ImageStoreVO store=imageStoreDao.findByName((String)params.get("String_Node_Str"));
  if (store != null) {
    return store;
  }
  store=new ImageStoreVO();
  store.setName((String)params.get("String_Node_Str"));
  store.setProtocol((String)params.get("String_Node_Str"));
  store.setProviderName((String)params.get("String_Node_Str"));
  store.setScope((ScopeType)params.get("String_Node_Str"));
  store.setUuid((String)params.get("String_Node_Str"));
  store.setUrl((String)params.get("String_Node_Str"));
  store.setRole((DataStoreRole)params.get("String_Node_Str"));
  store=imageStoreDao.persist(store);
  if (details != null) {
    Iterator<String> keyIter=details.keySet().iterator();
    while (keyIter.hasNext()) {
      String key=keyIter.next();
      ImageStoreDetailVO detail=new ImageStoreDetailVO();
      detail.setStoreId(store.getId());
      detail.setName(key);
      detail.setValue(details.get(key));
      imageStoreDetailsDao.persist(detail);
    }
  }
  return store;
}
Program: 106283
Project: 106283
Buggy source:
@Override public DataStore initialize(Map<String,Object> dsInfos){
  Long dcId=(Long)dsInfos.get("String_Node_Str");
  String url=(String)dsInfos.get("String_Node_Str");
  String providerName=(String)dsInfos.get("String_Node_Str");
  ScopeType scope=(ScopeType)dsInfos.get("String_Node_Str");
  Map<String,String> details=(Map<String,String>)dsInfos.get("String_Node_Str");
  s_logger.info("String_Node_Str" + dcId);
  try {
    _s3Mgr.verifyS3Fields(details);
  }
 catch (  DiscoveryException ex) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  Map<String,Object> imageStoreParameters=new HashMap<String,Object>();
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str",dcId);
  imageStoreParameters.put("String_Node_Str",url);
  String protocol="String_Node_Str";
  String useHttps=details.get(ApiConstants.S3_HTTPS_FLAG);
  if (useHttps != null && Boolean.parseBoolean(useHttps)) {
    protocol="String_Node_Str";
  }
  imageStoreParameters.put("String_Node_Str",protocol);
  if (scope != null) {
    imageStoreParameters.put("String_Node_Str",scope);
  }
 else {
    imageStoreParameters.put("String_Node_Str",ScopeType.REGION);
  }
  imageStoreParameters.put("String_Node_Str",providerName);
  ImageStoreVO ids=imageStoreHelper.createImageStore(imageStoreParameters,details);
  return imageStoreMgr.getImageStore(ids.getId());
}

Fixed version (ground truth):
@Override public DataStore initialize(Map<String,Object> dsInfos){
  Long dcId=(Long)dsInfos.get("String_Node_Str");
  String url=(String)dsInfos.get("String_Node_Str");
  String providerName=(String)dsInfos.get("String_Node_Str");
  ScopeType scope=(ScopeType)dsInfos.get("String_Node_Str");
  DataStoreRole role=(DataStoreRole)dsInfos.get("String_Node_Str");
  Map<String,String> details=(Map<String,String>)dsInfos.get("String_Node_Str");
  s_logger.info("String_Node_Str" + dcId);
  try {
    _s3Mgr.verifyS3Fields(details);
  }
 catch (  DiscoveryException ex) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  Map<String,Object> imageStoreParameters=new HashMap<String,Object>();
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str",dcId);
  imageStoreParameters.put("String_Node_Str",url);
  String protocol="String_Node_Str";
  String useHttps=details.get(ApiConstants.S3_HTTPS_FLAG);
  if (useHttps != null && Boolean.parseBoolean(useHttps)) {
    protocol="String_Node_Str";
  }
  imageStoreParameters.put("String_Node_Str",protocol);
  if (scope != null) {
    imageStoreParameters.put("String_Node_Str",scope);
  }
 else {
    imageStoreParameters.put("String_Node_Str",ScopeType.REGION);
  }
  imageStoreParameters.put("String_Node_Str",providerName);
  imageStoreParameters.put("String_Node_Str",role);
  ImageStoreVO ids=imageStoreHelper.createImageStore(imageStoreParameters,details);
  return imageStoreMgr.getImageStore(ids.getId());
}
Program: 106284
Project: 106284
Buggy source:
@Override public DataStore initialize(Map<String,Object> dsInfos){
  Long dcId=(Long)dsInfos.get("String_Node_Str");
  String url=(String)dsInfos.get("String_Node_Str");
  ScopeType scope=(ScopeType)dsInfos.get("String_Node_Str");
  String providerName=(String)dsInfos.get("String_Node_Str");
  Map<String,String> details=(Map<String,String>)dsInfos.get("String_Node_Str");
  s_logger.info("String_Node_Str" + url + "String_Node_Str"+ dcId);
  Map<String,Object> imageStoreParameters=new HashMap<String,Object>();
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str",dcId);
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str","String_Node_Str");
  if (scope != null) {
    imageStoreParameters.put("String_Node_Str",scope);
  }
 else {
    imageStoreParameters.put("String_Node_Str",ScopeType.REGION);
  }
  imageStoreParameters.put("String_Node_Str",providerName);
  ImageStoreVO ids=imageStoreHelper.createImageStore(imageStoreParameters);
  return imageStoreMgr.getImageStore(ids.getId());
}

Fixed version (ground truth):
@Override public DataStore initialize(Map<String,Object> dsInfos){
  Long dcId=(Long)dsInfos.get("String_Node_Str");
  String url=(String)dsInfos.get("String_Node_Str");
  ScopeType scope=(ScopeType)dsInfos.get("String_Node_Str");
  String providerName=(String)dsInfos.get("String_Node_Str");
  DataStoreRole role=(DataStoreRole)dsInfos.get("String_Node_Str");
  Map<String,String> details=(Map<String,String>)dsInfos.get("String_Node_Str");
  s_logger.info("String_Node_Str" + url + "String_Node_Str"+ dcId);
  Map<String,Object> imageStoreParameters=new HashMap<String,Object>();
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str",dcId);
  imageStoreParameters.put("String_Node_Str",url);
  imageStoreParameters.put("String_Node_Str","String_Node_Str");
  if (scope != null) {
    imageStoreParameters.put("String_Node_Str",scope);
  }
 else {
    imageStoreParameters.put("String_Node_Str",ScopeType.REGION);
  }
  imageStoreParameters.put("String_Node_Str",providerName);
  imageStoreParameters.put("String_Node_Str",role);
  ImageStoreVO ids=imageStoreHelper.createImageStore(imageStoreParameters,details);
  return imageStoreMgr.getImageStore(ids.getId());
}
Program: 106287
Project: 106287
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params){
  final Map<String,String> configs=_configDao.getConfiguration("String_Node_Str",params);
  _sslCopy=Boolean.parseBoolean(configs.get("String_Node_Str"));
  _proxy=configs.get(Config.SecStorageProxy.key());
  String cert=configs.get("String_Node_Str");
  if (!"String_Node_Str".equalsIgnoreCase(cert)) {
    s_logger.warn("String_Node_Str");
  }
  _copyAuthPasswd=configs.get("String_Node_Str");
  _agentMgr.registerForHostEvents(new DownloadListener(this),true,false,false);
  ReadyTemplateStatesSearch=_vmTemplateStoreDao.createSearchBuilder();
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getState(),SearchCriteria.Op.EQ);
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getDestroyed(),SearchCriteria.Op.EQ);
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getDataStoreId(),SearchCriteria.Op.EQ);
  SearchBuilder<VMTemplateVO> TemplatesWithNoChecksumSearch=_templateDao.createSearchBuilder();
  TemplatesWithNoChecksumSearch.and("String_Node_Str",TemplatesWithNoChecksumSearch.entity().getChecksum(),SearchCriteria.Op.NULL);
  ReadyTemplateStatesSearch.join("String_Node_Str",TemplatesWithNoChecksumSearch,TemplatesWithNoChecksumSearch.entity().getId(),ReadyTemplateStatesSearch.entity().getTemplateId(),JoinBuilder.JoinType.INNER);
  TemplatesWithNoChecksumSearch.done();
  ReadyTemplateStatesSearch.done();
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params){
  final Map<String,String> configs=_configDao.getConfiguration("String_Node_Str",params);
  _sslCopy=Boolean.parseBoolean(configs.get("String_Node_Str"));
  _proxy=configs.get(Config.SecStorageProxy.key());
  String cert=configs.get("String_Node_Str");
  if (!"String_Node_Str".equalsIgnoreCase(cert)) {
    s_logger.warn("String_Node_Str");
  }
  _copyAuthPasswd=configs.get("String_Node_Str");
  DownloadListener dl=new DownloadListener(this);
  ComponentContext.inject(dl);
  _agentMgr.registerForHostEvents(dl,true,false,false);
  ReadyTemplateStatesSearch=_vmTemplateStoreDao.createSearchBuilder();
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getState(),SearchCriteria.Op.EQ);
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getDestroyed(),SearchCriteria.Op.EQ);
  ReadyTemplateStatesSearch.and("String_Node_Str",ReadyTemplateStatesSearch.entity().getDataStoreId(),SearchCriteria.Op.EQ);
  SearchBuilder<VMTemplateVO> TemplatesWithNoChecksumSearch=_templateDao.createSearchBuilder();
  TemplatesWithNoChecksumSearch.and("String_Node_Str",TemplatesWithNoChecksumSearch.entity().getChecksum(),SearchCriteria.Op.NULL);
  ReadyTemplateStatesSearch.join("String_Node_Str",TemplatesWithNoChecksumSearch,TemplatesWithNoChecksumSearch.entity().getId(),ReadyTemplateStatesSearch.entity().getTemplateId(),JoinBuilder.JoinType.INNER);
  TemplatesWithNoChecksumSearch.done();
  ReadyTemplateStatesSearch.done();
  return true;
}
Program: 106289
Project: 106289
Buggy source:
@Override public HostVO createHostVOForDirectConnectAgent(HostVO host,StartupCommand[] startup,ServerResource resource,Map<String,String> details,List<String> hostTags){
  return host;
}

Fixed version (ground truth):
@Override public HostVO createHostVOForDirectConnectAgent(HostVO host,StartupCommand[] startup,ServerResource resource,Map<String,String> details,List<String> hostTags){
  return null;
}
Program: 106291
Project: 106291
Buggy source:
private String getExtrasWhere(TemplateFilter templateFilter,String name,String keyword,boolean isIso,Boolean bootable,HypervisorType hyperType,Long zoneId,boolean onlyReady,boolean showDomr,String zoneType){
  String sql="String_Node_Str";
  if (keyword != null) {
    sql+="String_Node_Str" + keyword + "String_Node_Str";
  }
 else   if (name != null) {
    sql+="String_Node_Str" + name + "String_Node_Str";
  }
  if (isIso) {
    sql+="String_Node_Str";
    if (!hyperType.equals(HypervisorType.None)) {
      sql+="String_Node_Str" + hyperType.toString() + "String_Node_Str";
    }
  }
 else {
    sql+="String_Node_Str";
    if (!hyperType.equals(HypervisorType.None)) {
      sql+="String_Node_Str" + hyperType.toString() + "String_Node_Str";
    }
  }
  if (bootable != null) {
    sql+="String_Node_Str" + bootable;
  }
  if (onlyReady) {
    sql+="String_Node_Str" + Status.DOWNLOADED.toString() + "String_Node_Str"+ "String_Node_Str";
    if (zoneId != null) {
      sql+="String_Node_Str" + zoneId;
    }
  }
 else   if (zoneId != null) {
    sql+="String_Node_Str" + zoneId + "String_Node_Str";
    if (zoneType != null) {
      sql+="String_Node_Str" + zoneType;
    }
  }
 else {
    sql+="String_Node_Str";
  }
  if (!showDomr) {
    sql+="String_Node_Str" + Storage.TemplateType.SYSTEM.toString() + "String_Node_Str";
  }
  sql+="String_Node_Str";
  return sql;
}

Fixed version (ground truth):
private String getExtrasWhere(TemplateFilter templateFilter,String name,String keyword,boolean isIso,Boolean bootable,HypervisorType hyperType,Long zoneId,boolean onlyReady,boolean showDomr,String zoneType){
  String sql="String_Node_Str";
  if (keyword != null) {
    sql+="String_Node_Str" + keyword + "String_Node_Str";
  }
 else   if (name != null) {
    sql+="String_Node_Str" + name + "String_Node_Str";
  }
  if (isIso) {
    sql+="String_Node_Str";
    if (!hyperType.equals(HypervisorType.None)) {
      sql+="String_Node_Str" + hyperType.toString() + "String_Node_Str";
    }
  }
 else {
    sql+="String_Node_Str";
    if (!hyperType.equals(HypervisorType.None)) {
      sql+="String_Node_Str" + hyperType.toString() + "String_Node_Str";
    }
  }
  if (bootable != null) {
    sql+="String_Node_Str" + bootable;
  }
  if (onlyReady) {
    sql+="String_Node_Str" + Status.DOWNLOADED.toString() + "String_Node_Str"+ "String_Node_Str";
    if (zoneId != null) {
      sql+="String_Node_Str" + zoneId;
    }
  }
 else   if (zoneId != null) {
    sql+="String_Node_Str" + zoneId + "String_Node_Str";
  }
 else {
    sql+="String_Node_Str";
  }
  if (zoneType != null) {
    sql+="String_Node_Str" + zoneType + "String_Node_Str";
  }
  if (!showDomr) {
    sql+="String_Node_Str" + Storage.TemplateType.SYSTEM.toString() + "String_Node_Str";
  }
  sql+="String_Node_Str";
  return sql;
}
Program: 106292
Project: 106292
Buggy source:
protected RemoteHostEndPoint(){
  executor=Executors.newScheduledThreadPool(10);
}

Fixed version (ground truth):
public RemoteHostEndPoint(){
  executor=Executors.newScheduledThreadPool(10);
}
Program: 106293
Project: 106293
Buggy source:
@Override public DataStore findStore(long objId,DataObjectType type,DataStoreRole role){
  DataStore store=null;
  if (role == DataStoreRole.Image) {
    DataObjectInStore vo=null;
switch (type) {
case TEMPLATE:
      vo=templateDataStoreDao.findByTemplate(objId);
case SNAPSHOT:
    vo=snapshotDataStoreDao.findBySnapshot(objId,role);
case VOLUME:
  vo=volumeDataStoreDao.findByVolume(objId);
}
if (vo != null) {
store=this.storeMgr.getDataStore(vo.getDataStoreId(),DataStoreRole.Image);
}
}
return store;
}

Fixed version (ground truth):
@Override public DataStore findStore(long objId,DataObjectType type,DataStoreRole role){
  DataStore store=null;
  if (role == DataStoreRole.Image) {
    DataObjectInStore vo=null;
switch (type) {
case TEMPLATE:
      vo=templateDataStoreDao.findByTemplate(objId);
    break;
case SNAPSHOT:
  vo=snapshotDataStoreDao.findBySnapshot(objId,role);
break;
case VOLUME:
vo=volumeDataStoreDao.findByVolume(objId);
break;
}
if (vo != null) {
store=this.storeMgr.getDataStore(vo.getDataStoreId(),DataStoreRole.Image);
}
}
return store;
}
Program: 106294
Project: 106294
Buggy source:
@Override public DataObjectInStore findObject(long objId,DataObjectType type,long dataStoreId,DataStoreRole role){
  DataObjectInStore vo=null;
  if (role == DataStoreRole.Image || role == DataStoreRole.ImageCache) {
switch (type) {
case TEMPLATE:
      vo=templateDataStoreDao.findByStoreTemplate(dataStoreId,objId);
case SNAPSHOT:
    vo=snapshotDataStoreDao.findByStoreSnapshot(role,dataStoreId,objId);
case VOLUME:
  vo=volumeDataStoreDao.findByStoreVolume(dataStoreId,objId);
}
}
 else if (type == DataObjectType.TEMPLATE && role == DataStoreRole.Primary) {
vo=templatePoolDao.findByPoolTemplate(dataStoreId,objId);
}
 else {
s_logger.debug("String_Node_Str" + type + "String_Node_Str"+ role);
throw new CloudRuntimeException("String_Node_Str" + type + "String_Node_Str"+ role);
}
return vo;
}

Fixed version (ground truth):
@Override public DataObjectInStore findObject(long objId,DataObjectType type,long dataStoreId,DataStoreRole role){
  DataObjectInStore vo=null;
  if (role == DataStoreRole.Image || role == DataStoreRole.ImageCache) {
switch (type) {
case TEMPLATE:
      vo=templateDataStoreDao.findByStoreTemplate(dataStoreId,objId);
    break;
case SNAPSHOT:
  vo=snapshotDataStoreDao.findByStoreSnapshot(role,dataStoreId,objId);
break;
case VOLUME:
vo=volumeDataStoreDao.findByStoreVolume(dataStoreId,objId);
break;
}
}
 else if (type == DataObjectType.TEMPLATE && role == DataStoreRole.Primary) {
vo=templatePoolDao.findByPoolTemplate(dataStoreId,objId);
}
 else {
s_logger.debug("String_Node_Str" + type + "String_Node_Str"+ role);
throw new CloudRuntimeException("String_Node_Str" + type + "String_Node_Str"+ role);
}
return vo;
}
Program: 106295
Project: 106295
Buggy source:
@Override public boolean update(DataObject data,Event event) throws NoTransitionException {
  DataObjectInStore obj=this.findObject(data,data.getDataStore());
  if (obj == null) {
    throw new CloudRuntimeException("String_Node_Str" + data);
  }
  if (data.getDataStore().getRole() == DataStoreRole.Image || data.getDataStore().getRole() == DataStoreRole.ImageCache) {
switch (data.getType()) {
case TEMPLATE:
      this.stateMachines.transitTo(obj,event,null,templateDataStoreDao);
case SNAPSHOT:
    this.stateMachines.transitTo(obj,event,null,snapshotDataStoreDao);
case VOLUME:
  this.stateMachines.transitTo(obj,event,null,volumeDataStoreDao);
}
}
 else if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) {
this.stateMachines.transitTo(obj,event,null,templatePoolDao);
}
 else {
throw new CloudRuntimeException("String_Node_Str" + data.getType() + "String_Node_Str"+ data.getDataStore().getRole());
}
return true;
}

Fixed version (ground truth):
@Override public boolean update(DataObject data,Event event) throws NoTransitionException {
  DataObjectInStore obj=this.findObject(data,data.getDataStore());
  if (obj == null) {
    throw new CloudRuntimeException("String_Node_Str" + data);
  }
  if (data.getDataStore().getRole() == DataStoreRole.Image || data.getDataStore().getRole() == DataStoreRole.ImageCache) {
switch (data.getType()) {
case TEMPLATE:
      this.stateMachines.transitTo(obj,event,null,templateDataStoreDao);
    break;
case SNAPSHOT:
  this.stateMachines.transitTo(obj,event,null,snapshotDataStoreDao);
break;
case VOLUME:
this.stateMachines.transitTo(obj,event,null,volumeDataStoreDao);
break;
}
}
 else if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) {
this.stateMachines.transitTo(obj,event,null,templatePoolDao);
}
 else {
throw new CloudRuntimeException("String_Node_Str" + data.getType() + "String_Node_Str"+ data.getDataStore().getRole());
}
return true;
}
Program: 106296
Project: 106296
Buggy source:
@Override public DataStoreTO getTO(){
  return getDriver().getStoreTO(this);
}

Fixed version (ground truth):
@Override public DataStoreTO getTO(){
  DataStoreTO to=getDriver().getStoreTO(this);
  if (to == null) {
    PrimaryDataStoreTO primaryTO=new PrimaryDataStoreTO(this);
    return primaryTO;
  }
  return to;
}
Program: 106297
Project: 106297
Buggy source:
@Override public Answer ListTemplates(ListTemplateCommand cmd){
  Transaction txn=Transaction.open(Transaction.SIMULATOR_DB);
  MockSecStorageVO storage=null;
  try {
    txn.start();
    storage=_mockSecStorageDao.findByUrl(cmd.getSecUrl());
    if (storage == null) {
      return new Answer(cmd,false,"String_Node_Str");
    }
    txn.commit();
  }
 catch (  Exception ex) {
    txn.rollback();
    throw new CloudRuntimeException("String_Node_Str" + cmd.getSecUrl(),ex);
  }
 finally {
    txn.close();
    txn=Transaction.open(Transaction.CLOUD_DB);
    txn.close();
  }
  txn=Transaction.open(Transaction.SIMULATOR_DB);
  try {
    txn.start();
    List<MockVolumeVO> templates=_mockVolumeDao.findByStorageIdAndType(storage.getId(),MockVolumeType.TEMPLATE);
    Map<String,TemplateProp> templateInfos=new HashMap<String,TemplateProp>();
    for (    MockVolumeVO template : templates) {
      templateInfos.put(template.getName(),new TemplateProp(template.getName(),template.getPath().replaceAll(storage.getMountPoint(),"String_Node_Str"),template.getSize(),template.getSize(),true,false));
    }
    txn.commit();
    return new ListTemplateAnswer(cmd.getSecUrl(),templateInfos);
  }
 catch (  Exception ex) {
    txn.rollback();
    throw new CloudRuntimeException("String_Node_Str" + storage.getId(),ex);
  }
 finally {
    txn.close();
    txn=Transaction.open(Transaction.CLOUD_DB);
    txn.close();
  }
}

Fixed version (ground truth):
@Override public Answer ListTemplates(ListTemplateCommand cmd){
  DataStoreTO store=cmd.getDataStore();
  if (!(store instanceof NfsTO)) {
    return new Answer(cmd,false,"String_Node_Str" + store);
  }
  Transaction txn=Transaction.open(Transaction.SIMULATOR_DB);
  MockSecStorageVO storage=null;
  String nfsUrl=((NfsTO)cmd.getDataStore()).getUrl();
  try {
    txn.start();
    storage=_mockSecStorageDao.findByUrl(nfsUrl);
    if (storage == null) {
      return new Answer(cmd,false,"String_Node_Str");
    }
    txn.commit();
  }
 catch (  Exception ex) {
    txn.rollback();
    throw new CloudRuntimeException("String_Node_Str" + nfsUrl,ex);
  }
 finally {
    txn.close();
    txn=Transaction.open(Transaction.CLOUD_DB);
    txn.close();
  }
  txn=Transaction.open(Transaction.SIMULATOR_DB);
  try {
    txn.start();
    List<MockVolumeVO> templates=_mockVolumeDao.findByStorageIdAndType(storage.getId(),MockVolumeType.TEMPLATE);
    Map<String,TemplateProp> templateInfos=new HashMap<String,TemplateProp>();
    for (    MockVolumeVO template : templates) {
      templateInfos.put(template.getName(),new TemplateProp(template.getName(),template.getPath().replaceAll(storage.getMountPoint(),"String_Node_Str"),template.getSize(),template.getSize(),true,false));
    }
    txn.commit();
    return new ListTemplateAnswer(nfsUrl,templateInfos);
  }
 catch (  Exception ex) {
    txn.rollback();
    throw new CloudRuntimeException("String_Node_Str" + storage.getId(),ex);
  }
 finally {
    txn.close();
    txn=Transaction.open(Transaction.CLOUD_DB);
    txn.close();
  }
}
Program: 106298
Project: 106298
Buggy source:
private boolean validateDiscoveredHosts(VmwareContext context,ManagedObjectReference morCluster,List<ManagedObjectReference> morHosts) throws Exception {
  if (morCluster == null) {
    for (    ManagedObjectReference morHost : morHosts) {
      ManagedObjectReference morParent=(ManagedObjectReference)context.getVimClient().getDynamicProperty(morHost,"String_Node_Str");
      if (morParent.getProtocol().equalsIgnoreCase("String_Node_Str"))       return false;
    }
  }
 else {
    for (    ManagedObjectReference morHost : morHosts) {
      ManagedObjectReference morParent=(ManagedObjectReference)context.getVimClient().getDynamicProperty(morHost,"String_Node_Str");
      if (!morParent.getProtocol().equalsIgnoreCase("String_Node_Str"))       return false;
      if (!morParent.getValue().equals(morCluster.getValue()))       return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean validateDiscoveredHosts(VmwareContext context,ManagedObjectReference morCluster,List<ManagedObjectReference> morHosts) throws Exception {
  if (morCluster == null) {
    for (    ManagedObjectReference morHost : morHosts) {
      ManagedObjectReference morParent=(ManagedObjectReference)context.getVimClient().getDynamicProperty(morHost,"String_Node_Str");
      if (morParent.getType().equalsIgnoreCase("String_Node_Str"))       return false;
    }
  }
 else {
    for (    ManagedObjectReference morHost : morHosts) {
      ManagedObjectReference morParent=(ManagedObjectReference)context.getVimClient().getDynamicProperty(morHost,"String_Node_Str");
      if (!morParent.getType().equalsIgnoreCase("String_Node_Str"))       return false;
      if (!morParent.getValue().equals(morCluster.getValue()))       return false;
    }
  }
  return true;
}
Program: 106302
Project: 106302
Buggy source:
@Override public VmwareHypervisorHost getHyperHost(VmwareContext context,Command cmd){
  if (_morHyperHost.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    return new HostMO(context,_morHyperHost);
  }
  return new ClusterMO(context,_morHyperHost);
}

Fixed version (ground truth):
@Override public VmwareHypervisorHost getHyperHost(VmwareContext context,Command cmd){
  if (_morHyperHost.getType().equalsIgnoreCase("String_Node_Str")) {
    return new HostMO(context,_morHyperHost);
  }
  return new ClusterMO(context,_morHyperHost);
}
Program: 106304
Project: 106304
Buggy source:
private boolean validateContext(VmwareContext context,Command cmd){
  String guid=cmd.getContextParam("String_Node_Str");
  assert(guid != null);
  String[] tokens=guid.split("String_Node_Str");
  assert(tokens != null && tokens.length == 2);
  ManagedObjectReference morHyperHost=new ManagedObjectReference();
  String[] hostTokens=tokens[0].split("String_Node_Str");
  assert(hostTokens.length == 2);
  morHyperHost.setType(hostTokens[0]);
  morHyperHost.setValue(hostTokens[1]);
  if (morHyperHost.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    HostMO hostMo=new HostMO(context,morHyperHost);
    try {
      VmwareHypervisorHostNetworkSummary netSummary=hostMo.getHyperHostNetworkSummary(hostMo.getHostType() == VmwareHostType.ESXi ? cmd.getContextParam("String_Node_Str") : cmd.getContextParam("String_Node_Str"));
      assert(netSummary != null);
      if (netSummary.getHostIp() != null && !netSummary.getHostIp().isEmpty()) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + netSummary.getHostIp() + "String_Node_Str"+ guid);
        }
        return true;
      }
      s_logger.warn("String_Node_Str");
      return false;
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str" + VmwareHelper.getExceptionMessage(e));
      return false;
    }
  }
  assert(false);
  return true;
}

Fixed version (ground truth):
private boolean validateContext(VmwareContext context,Command cmd){
  String guid=cmd.getContextParam("String_Node_Str");
  assert(guid != null);
  String[] tokens=guid.split("String_Node_Str");
  assert(tokens != null && tokens.length == 2);
  ManagedObjectReference morHyperHost=new ManagedObjectReference();
  String[] hostTokens=tokens[0].split("String_Node_Str");
  assert(hostTokens.length == 2);
  morHyperHost.setType(hostTokens[0]);
  morHyperHost.setValue(hostTokens[1]);
  if (morHyperHost.getType().equalsIgnoreCase("String_Node_Str")) {
    HostMO hostMo=new HostMO(context,morHyperHost);
    try {
      VmwareHypervisorHostNetworkSummary netSummary=hostMo.getHyperHostNetworkSummary(hostMo.getHostType() == VmwareHostType.ESXi ? cmd.getContextParam("String_Node_Str") : cmd.getContextParam("String_Node_Str"));
      assert(netSummary != null);
      if (netSummary.getHostIp() != null && !netSummary.getHostIp().isEmpty()) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + netSummary.getHostIp() + "String_Node_Str"+ guid);
        }
        return true;
      }
      s_logger.warn("String_Node_Str");
      return false;
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str" + VmwareHelper.getExceptionMessage(e));
      return false;
    }
  }
  assert(false);
  return true;
}
Program: 106305
Project: 106305
Buggy source:
@Override public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan,ExcludeList avoid) throws AffinityConflictException {
  VirtualMachine vm=vmProfile.getVirtualMachine();
  AffinityGroupVMMapVO vmGroupMapping=_affinityGroupVMMapDao.findByVmIdType(vm.getId(),getType());
  if (vmGroupMapping != null) {
    AffinityGroupVO group=_affinityGroupDao.findById(vmGroupMapping.getAffinityGroupId());
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + group.getName() + "String_Node_Str"+ vm.getId());
    }
    List<Long> groupVMIds=_affinityGroupVMMapDao.listVmIdsByAffinityGroup(group.getId());
    for (    Long groupVMId : groupVMIds) {
      VMInstanceVO groupVM=_vmInstanceDao.findById(groupVMId);
      if (groupVM != null && !groupVM.isRemoved()) {
        if (groupVM.getHostId() != null) {
          avoid.addHost(groupVM.getHostId());
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + groupVM.getHostId() + "String_Node_Str"+ groupVM.getId()+ "String_Node_Str");
          }
        }
 else         if (VirtualMachine.State.Stopped.equals(groupVM.getState()) && groupVM.getLastHostId() != null) {
          avoid.addHost(groupVM.getLastHostId());
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + groupVM.getLastHostId() + "String_Node_Str"+ groupVM.getId()+ "String_Node_Str");
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan,ExcludeList avoid) throws AffinityConflictException {
  VirtualMachine vm=vmProfile.getVirtualMachine();
  AffinityGroupVMMapVO vmGroupMapping=_affinityGroupVMMapDao.findByVmIdType(vm.getId(),getType());
  if (vmGroupMapping != null) {
    AffinityGroupVO group=_affinityGroupDao.findById(vmGroupMapping.getAffinityGroupId());
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + group.getName() + "String_Node_Str"+ vm.getId());
    }
    List<Long> groupVMIds=_affinityGroupVMMapDao.listVmIdsByAffinityGroup(group.getId());
    groupVMIds.remove(vm.getId());
    for (    Long groupVMId : groupVMIds) {
      VMInstanceVO groupVM=_vmInstanceDao.findById(groupVMId);
      if (groupVM != null && !groupVM.isRemoved()) {
        if (groupVM.getHostId() != null) {
          avoid.addHost(groupVM.getHostId());
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + groupVM.getHostId() + "String_Node_Str"+ groupVM.getId()+ "String_Node_Str");
          }
        }
 else         if (VirtualMachine.State.Stopped.equals(groupVM.getState()) && groupVM.getLastHostId() != null) {
          avoid.addHost(groupVM.getLastHostId());
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + groupVM.getLastHostId() + "String_Node_Str"+ groupVM.getId()+ "String_Node_Str");
          }
        }
      }
    }
  }
}
Program: 106307
Project: 106307
Buggy source:
@Override public UserVm updateVMAffinityGroups(Long vmId,List<Long> affinityGroupIds){
  UserVmVO vmInstance=_userVmDao.findById(vmId);
  if (vmInstance == null) {
    throw new InvalidParameterValueException("String_Node_Str" + vmId);
  }
  if (!vmInstance.getState().equals(State.Stopped)) {
    s_logger.warn("String_Node_Str" + vmInstance.toString() + "String_Node_Str"+ vmInstance.getState());
    throw new InvalidParameterValueException("String_Node_Str" + vmInstance.toString() + "String_Node_Str"+ "String_Node_Str"+ vmInstance.getState()+ "String_Node_Str");
  }
  for (  Long affinityGroupId : affinityGroupIds) {
    AffinityGroupVO ag=_affinityGroupDao.findById(affinityGroupId);
    if (ag == null) {
      throw new InvalidParameterValueException("String_Node_Str" + affinityGroupId);
    }
  }
  _affinityGroupVMMapDao.updateMap(vmId,affinityGroupIds);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId + "String_Node_Str"+ affinityGroupIds);
  }
  return vmInstance;
}

Fixed version (ground truth):
@Override public UserVm updateVMAffinityGroups(Long vmId,List<Long> affinityGroupIds){
  UserVmVO vmInstance=_userVmDao.findById(vmId);
  if (vmInstance == null) {
    throw new InvalidParameterValueException("String_Node_Str" + vmId);
  }
  if (!vmInstance.getState().equals(State.Stopped)) {
    s_logger.warn("String_Node_Str" + vmInstance.toString() + "String_Node_Str"+ vmInstance.getState());
    throw new InvalidParameterValueException("String_Node_Str" + vmInstance.toString() + "String_Node_Str"+ "String_Node_Str"+ vmInstance.getState()+ "String_Node_Str");
  }
  Account caller=UserContext.current().getCaller();
  Account owner=_accountMgr.getAccount(vmInstance.getAccountId());
  for (  Long affinityGroupId : affinityGroupIds) {
    AffinityGroupVO ag=_affinityGroupDao.findById(affinityGroupId);
    if (ag == null) {
      throw new InvalidParameterValueException("String_Node_Str" + affinityGroupId);
    }
 else {
      _accountMgr.checkAccess(caller,null,true,owner,ag);
    }
  }
  _affinityGroupVMMapDao.updateMap(vmId,affinityGroupIds);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId + "String_Node_Str"+ affinityGroupIds);
  }
  return vmInstance;
}
Program: 106308
Project: 106308
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.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();
}
Program: 106309
Project: 106309
Buggy source:
@Override public void deployVirtualMachine(String reservationId,String caller,Map<VirtualMachineProfile.Param,Object> params) throws InsufficientCapacityException, ResourceUnavailableException {
  VMReservationVO vmReservation=_reservationDao.findByReservationId(reservationId);
  long vmId=vmReservation.getVmId();
  VMInstanceVO vm=_vmDao.findById(vmId);
  Long poolId=null;
  Map<Long,Long> storage=vmReservation.getVolumeReservation();
  if (storage != null) {
    List<Long> volIdList=new ArrayList<Long>(storage.keySet());
    if (volIdList != null && !volIdList.isEmpty()) {
      poolId=storage.get(volIdList.get(0));
    }
  }
  DataCenterDeployment plan=new DataCenterDeployment(vm.getDataCenterId(),vmReservation.getPodId(),vmReservation.getClusterId(),vmReservation.getHostId(),poolId,null);
  VMInstanceVO vmDeployed=_itMgr.start(vm,params,_userDao.findById(new Long(caller)),_accountDao.findById(vm.getAccountId()),plan);
}

Fixed version (ground truth):
@Override public void deployVirtualMachine(String reservationId,String caller,Map<VirtualMachineProfile.Param,Object> params) throws InsufficientCapacityException, ResourceUnavailableException {
  VMReservationVO vmReservation=_reservationDao.findByReservationId(reservationId);
  long vmId=vmReservation.getVmId();
  VMInstanceVO vm=_vmDao.findById(vmId);
  Long poolId=null;
  Map<Long,Long> storage=vmReservation.getVolumeReservation();
  if (storage != null) {
    List<Long> volIdList=new ArrayList<Long>(storage.keySet());
    if (volIdList != null && !volIdList.isEmpty()) {
      poolId=storage.get(volIdList.get(0));
    }
  }
  DataCenterDeployment plan=new DataCenterDeployment(vm.getDataCenterId(),vmReservation.getPodId(),vmReservation.getClusterId(),vmReservation.getHostId(),null,null);
  VMInstanceVO vmDeployed=_itMgr.start(vm,params,_userDao.findById(new Long(caller)),_accountDao.findById(vm.getAccountId()),plan);
}
Program: 106310
Project: 106310
Buggy source:
/** 
 * This method should reorder the given list of Pod Ids by applying any necessary heuristic  for this planner For FirstFitPlanner there is no specific heuristic to be applied  other than the capacity based ordering which is done by default.
 * @return List<Long> ordered list of Pod Ids
 */
protected List<Long> reorderPods(Pair<List<Long>,Map<Long,Double>> podCapacityInfo,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan){
  List<Long> podIdsByCapacity=podCapacityInfo.first();
  return podIdsByCapacity;
}

Fixed version (ground truth):
/** 
 * This method should reorder the given list of Pod Ids by applying any necessary heuristic for this planner For FirstFitPlanner there is no specific heuristic to be applied other than the capacity based ordering which is done by default.
 * @return List<Long> ordered list of Pod Ids
 */
protected List<Long> reorderPods(Pair<List<Long>,Map<Long,Double>> podCapacityInfo,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan){
  List<Long> podIdsByCapacity=podCapacityInfo.first();
  return podIdsByCapacity;
}
Program: 106311
Project: 106311
Buggy source:
/** 
 * This method should reorder the given list of Cluster Ids by applying any necessary heuristic  for this planner For FirstFitPlanner there is no specific heuristic to be applied  other than the capacity based ordering which is done by default.
 * @return List<Long> ordered list of Cluster Ids
 */
protected List<Long> reorderClusters(long id,boolean isZone,Pair<List<Long>,Map<Long,Double>> clusterCapacityInfo,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan){
  List<Long> reordersClusterIds=clusterCapacityInfo.first();
  return reordersClusterIds;
}

Fixed version (ground truth):
/** 
 * This method should reorder the given list of Cluster Ids by applying any necessary heuristic for this planner For FirstFitPlanner there is no specific heuristic to be applied other than the capacity based ordering which is done by default.
 * @return List<Long> ordered list of Cluster Ids
 */
protected List<Long> reorderClusters(long id,boolean isZone,Pair<List<Long>,Map<Long,Double>> clusterCapacityInfo,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan){
  List<Long> reordersClusterIds=clusterCapacityInfo.first();
  return reordersClusterIds;
}
Program: 106312
Project: 106312
Buggy source:
@Override protected List<StoragePool> select(DiskProfile dskCh,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan,ExcludeList avoid,int returnUpTo){
  List<StoragePool> suitablePools=new ArrayList<StoragePool>();
  long dcId=plan.getDataCenterId();
  Long podId=plan.getPodId();
  Long clusterId=plan.getClusterId();
  if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
    s_logger.debug("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ Arrays.toString(dskCh.getTags()));
  }
 else {
    s_logger.debug("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId);
  }
  List<StoragePoolVO> pools=_storagePoolDao.findPoolsByTags(dcId,podId,clusterId,dskCh.getTags());
  if (pools.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      String storageType=dskCh.useLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString();
      s_logger.debug("String_Node_Str" + storageType + "String_Node_Str");
    }
    return suitablePools;
  }
  for (  StoragePoolVO pool : pools) {
    if (suitablePools.size() == returnUpTo) {
      break;
    }
    StoragePool pol=(StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId());
    if (filter(avoid,pol,dskCh,plan)) {
      suitablePools.add(pol);
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + suitablePools.size() + "String_Node_Str");
  }
  return suitablePools;
}

Fixed version (ground truth):
@Override protected List<StoragePool> select(DiskProfile dskCh,VirtualMachineProfile<? extends VirtualMachine> vmProfile,DeploymentPlan plan,ExcludeList avoid,int returnUpTo){
  s_logger.debug("String_Node_Str");
  List<StoragePool> suitablePools=new ArrayList<StoragePool>();
  long dcId=plan.getDataCenterId();
  Long podId=plan.getPodId();
  Long clusterId=plan.getClusterId();
  if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
    s_logger.debug("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ Arrays.toString(dskCh.getTags()));
  }
 else {
    s_logger.debug("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId);
  }
  List<StoragePoolVO> pools=_storagePoolDao.findPoolsByTags(dcId,podId,clusterId,dskCh.getTags());
  if (pools.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      String storageType=dskCh.useLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString();
      s_logger.debug("String_Node_Str" + storageType + "String_Node_Str");
    }
    return suitablePools;
  }
  for (  StoragePoolVO pool : pools) {
    if (suitablePools.size() == returnUpTo) {
      break;
    }
    StoragePool pol=(StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId());
    if (filter(avoid,pol,dskCh,plan)) {
      suitablePools.add(pol);
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + suitablePools.size() + "String_Node_Str");
  }
  return suitablePools;
}