nus-yam/ex-repair huggingface dataset:
Program: 105981
Project: 105981
Buggy source:
@Override public void checkNetworkPermissions(Account owner,Network network){
  if (network == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  if (network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
    AccountVO networkOwner=_accountDao.findById(network.getAccountId());
    if (networkOwner == null)     throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
    if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      if (!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(),network.getAccountId())) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
 else {
      List<NetworkVO> networkMap=_networksDao.listBy(owner.getId(),network.getId());
      if (networkMap == null || networkMap.isEmpty()) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
  }
 else {
    if (!isNetworkAvailableInDomain(network.getId(),owner.getDomainId())) {
      throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str"+ owner.getDomainId());
    }
  }
}

Fixed version (ground truth):
@Override public void checkNetworkPermissions(Account owner,Network network){
  if (network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
    AccountVO networkOwner=_accountDao.findById(network.getAccountId());
    if (networkOwner == null)     throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
    if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      if (!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(),network.getAccountId())) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
 else {
      List<NetworkVO> networkMap=_networksDao.listBy(owner.getId(),network.getId());
      if (networkMap == null || networkMap.isEmpty()) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
  }
 else {
    if (!isNetworkAvailableInDomain(network.getId(),owner.getDomainId())) {
      throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str"+ owner.getDomainId());
    }
  }
}
Program: 105982
Project: 105982
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  Map<String,String> dbParams=_configDao.getConfiguration(params);
  _cidr=dbParams.get(Config.ControlCidr.toString());
  if (_cidr == null) {
    _cidr="String_Node_Str";
  }
  _gateway=dbParams.get(Config.ControlGateway.toString());
  if (_gateway == null) {
    _gateway=NetUtils.getLinkLocalGateway();
  }
  s_logger.info("String_Node_Str" + _cidr + "String_Node_Str"+ _gateway);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  Map<String,String> dbParams=_configDao.getConfiguration(params);
  _cidr=dbParams.get(Config.ControlCidr);
  if (_cidr == null) {
    _cidr="String_Node_Str";
  }
  _gateway=dbParams.get(Config.ControlGateway);
  if (_gateway == null) {
    _gateway=NetUtils.getLinkLocalGateway();
  }
  s_logger.info("String_Node_Str" + _cidr + "String_Node_Str"+ _gateway);
  return true;
}
Program: 105983
Project: 105983
Buggy source:
@Override public Map<Service,Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<VpcOfferingServiceMapVO> map=_vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
  for (  VpcOfferingServiceMapVO instance : map) {
    Service service=Service.getService(instance.getService());
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(service,providers);
  }
  return serviceProviderMap;
}

Fixed version (ground truth):
@Override public Map<Service,Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<VpcOfferingServiceMapVO> map=_vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
  for (  VpcOfferingServiceMapVO instance : map) {
    String service=instance.getService();
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(Service.getService(service),providers);
  }
  return serviceProviderMap;
}
Program: 105986
Project: 105986
Buggy source:
@Inject public void setApiAccessCheckers(List<APIChecker> apiAccessCheckers){
  this._apiAccessCheckers=apiAccessCheckers;
}

Fixed version (ground truth):
@Inject public void setApiAccessCheckers(List<APIChecker> apiAccessCheckers){
  _apiAccessCheckers=apiAccessCheckers;
}
Program: 105988
Project: 105988
Buggy source:
@Inject public void setPluggableServices(List<PluggableService> pluggableServices){
  this._pluggableServices=pluggableServices;
}

Fixed version (ground truth):
@Inject public void setPluggableServices(List<PluggableService> pluggableServices){
  _pluggableServices=pluggableServices;
}
Program: 105990
Project: 105990
Buggy source:
private void writeResponse(HttpServletResponse resp,String response,int responseCode,String responseType){
  try {
    if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
      resp.setContentType(ApiServer.jsonContentType + "String_Node_Str");
    }
 else {
      resp.setContentType("String_Node_Str");
    }
    resp.setStatus(responseCode);
    resp.getWriter().print(response);
  }
 catch (  IOException ioex) {
    if (s_logger.isTraceEnabled()) {
      s_logger.trace("String_Node_Str" + ioex);
    }
  }
catch (  Exception ex) {
    if (!(ex instanceof IllegalStateException)) {
      s_logger.error("String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
private void writeResponse(HttpServletResponse resp,String response,int responseCode,String responseType){
  try {
    if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
      resp.setContentType(ApiServer.getJsonContentType() + "String_Node_Str");
    }
 else {
      resp.setContentType("String_Node_Str");
    }
    resp.setStatus(responseCode);
    resp.getWriter().print(response);
  }
 catch (  IOException ioex) {
    if (s_logger.isTraceEnabled()) {
      s_logger.trace("String_Node_Str" + ioex);
    }
  }
catch (  Exception ex) {
    if (!(ex instanceof IllegalStateException)) {
      s_logger.error("String_Node_Str",ex);
    }
  }
}
Program: 105991
Project: 105991
Buggy source:
private static String encodeString(String value){
  if (!ApiServer.encodeApiResponse) {
    return value;
  }
  try {
    return new URLEncoder().encode(value).replaceAll("String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str" + value,e);
  }
  return value;
}

Fixed version (ground truth):
private static String encodeString(String value){
  if (!ApiServer.isEncodeApiResponse()) {
    return value;
  }
  try {
    return new URLEncoder().encode(value).replaceAll("String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str" + value,e);
  }
  return value;
}
Program: 105992
Project: 105992
Buggy source:
public Argument getResArgByName(String name){
  for (  Argument a : this.getResponse()) {
    if (a.getName().equals(name)) {
      return a;
    }
  }
  return null;
}

Fixed version (ground truth):
public Argument getResArgByName(String name){
  for (  Argument a : getResponse()) {
    if (a.getName().equals(name)) {
      return a;
    }
  }
  return null;
}
Program: 105993
Project: 105993
Buggy source:
public Argument getReqArgByName(String name){
  for (  Argument a : this.getRequest()) {
    if (a.getName().equals(name)) {
      return a;
    }
  }
  return null;
}

Fixed version (ground truth):
public Argument getReqArgByName(String name){
  for (  Argument a : getRequest()) {
    if (a.getName().equals(name)) {
      return a;
    }
  }
  return null;
}
Program: 105994
Project: 105994
Buggy source:
private static String encodeParam(String value){
  if (!ApiServer.encodeApiResponse) {
    return value;
  }
  try {
    return new URLEncoder().encode(value).replaceAll("String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str" + value,e);
  }
  return value;
}

Fixed version (ground truth):
private static String encodeParam(String value){
  if (!ApiServer.isEncodeApiResponse()) {
    return value;
  }
  try {
    return new URLEncoder().encode(value).replaceAll("String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str" + value,e);
  }
  return value;
}
Program: 105997
Project: 105997
Buggy source:
@Override public ResourceLimitResponse createResourceLimitResponse(ResourceLimit limit){
  ResourceLimitResponse resourceLimitResponse=new ResourceLimitResponse();
  if (limit.getResourceOwnerType() == ResourceOwnerType.Domain) {
    populateDomain(resourceLimitResponse,limit.getOwnerId());
  }
 else   if (limit.getResourceOwnerType() == ResourceOwnerType.Account) {
    Account accountTemp=ApiDBUtils.findAccountById(limit.getOwnerId());
    populateAccount(resourceLimitResponse,limit.getOwnerId());
    populateDomain(resourceLimitResponse,accountTemp.getDomainId());
  }
  resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().getOrdinal()).toString());
  if ((limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) && limit.getMax() >= 0) {
    resourceLimitResponse.setMax((long)Math.ceil(limit.getMax() / ResourceType.bytesToGiB));
  }
 else {
    resourceLimitResponse.setMax(limit.getMax());
  }
  resourceLimitResponse.setObjectName("String_Node_Str");
  return resourceLimitResponse;
}

Fixed version (ground truth):
@Override public ResourceLimitResponse createResourceLimitResponse(ResourceLimit limit){
  ResourceLimitResponse resourceLimitResponse=new ResourceLimitResponse();
  if (limit.getResourceOwnerType() == ResourceOwnerType.Domain) {
    populateDomain(resourceLimitResponse,limit.getOwnerId());
  }
 else   if (limit.getResourceOwnerType() == ResourceOwnerType.Account) {
    Account accountTemp=ApiDBUtils.findAccountById(limit.getOwnerId());
    populateAccount(resourceLimitResponse,limit.getOwnerId());
    populateDomain(resourceLimitResponse,accountTemp.getDomainId());
  }
  resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().getOrdinal()).toString());
  if ((limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) && limit.getMax() >= 0) {
    resourceLimitResponse.setMax((long)Math.ceil((double)limit.getMax() / ResourceType.bytesToGiB));
  }
 else {
    resourceLimitResponse.setMax(limit.getMax());
  }
  resourceLimitResponse.setObjectName("String_Node_Str");
  return resourceLimitResponse;
}
Program: 105998
Project: 105998
Buggy source:
@Override public StaticRouteResponse createStaticRouteResponse(StaticRoute result){
  StaticRouteResponse response=new StaticRouteResponse();
  response.setId(result.getUuid());
  if (result.getVpcId() != null) {
    Vpc vpc=ApiDBUtils.findVpcById(result.getVpcId());
    if (vpc != null) {
      response.setVpcId(vpc.getUuid());
    }
  }
  response.setCidr(result.getCidr());
  StaticRoute.State state=result.getState();
  String stateToSet=state.toString();
  if (state.equals(FirewallRule.State.Revoke)) {
    stateToSet="String_Node_Str";
  }
  response.setState(stateToSet);
  populateAccount(response,result.getAccountId());
  populateDomain(response,result.getDomainId());
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.StaticRoute,result.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    tagResponses.add(tagResponse);
  }
  response.setTags(tagResponses);
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public StaticRouteResponse createStaticRouteResponse(StaticRoute result){
  StaticRouteResponse response=new StaticRouteResponse();
  response.setId(result.getUuid());
  if (result.getVpcId() != null) {
    Vpc vpc=ApiDBUtils.findVpcById(result.getVpcId());
    if (vpc != null) {
      response.setVpcId(vpc.getUuid());
    }
  }
  response.setCidr(result.getCidr());
  StaticRoute.State state=result.getState();
  if (state.equals(StaticRoute.State.Revoke)) {
    state=StaticRoute.State.Deleting;
  }
  response.setState(state.toString());
  populateAccount(response,result.getAccountId());
  populateDomain(response,result.getDomainId());
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.StaticRoute,result.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    tagResponses.add(tagResponse);
  }
  response.setTags(tagResponses);
  response.setObjectName("String_Node_Str");
  return response;
}
Program: 105999
Project: 105999
Buggy source:
public String getDetail(String name){
}

Fixed version (ground truth):
public String getDetail(String name){
  if (details == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  return details.get(name);
}
Program: 106000
Project: 106000
Buggy source:
@Override public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd){
  StartConsoleProxyAgentHttpHandlerCommand cmd=null;
  String storePassword=String.valueOf(_random.nextLong());
  byte[] ksBits=_ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME,ConsoleProxyManager.CERTIFICATE_NAME,storePassword);
  assert(ksBits != null);
  if (ksBits == null) {
    s_logger.error("String_Node_Str");
  }
  cmd=new StartConsoleProxyAgentHttpHandlerCommand(ksBits,storePassword);
  cmd.setEncryptorPassword(getEncryptorPassword());
  try {
    HostVO consoleProxyHost=findConsoleProxyHost(startupCmd);
    assert(consoleProxyHost != null);
    Answer answer=_agentMgr.send(consoleProxyHost.getId(),cmd);
    if (answer == null || !answer.getResult()) {
      s_logger.error("String_Node_Str");
    }
 else {
      s_logger.info("String_Node_Str");
    }
  }
 catch (  AgentUnavailableException e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
catch (  OperationTimedoutException e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
catch (  OutOfMemoryError e) {
    s_logger.error("String_Node_Str");
    System.exit(1);
  }
catch (  Exception e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
}

Fixed version (ground truth):
@Override public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd){
  StartConsoleProxyAgentHttpHandlerCommand cmd=null;
  String storePassword=String.valueOf(_random.nextLong());
  byte[] ksBits=_ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME,ConsoleProxyManager.CERTIFICATE_NAME,storePassword);
  assert(ksBits != null);
  if (ksBits == null) {
    String msg="String_Node_Str";
    s_logger.error(msg);
    throw new CloudRuntimeException(msg);
  }
  cmd=new StartConsoleProxyAgentHttpHandlerCommand(ksBits,storePassword);
  cmd.setEncryptorPassword(getEncryptorPassword());
  try {
    HostVO consoleProxyHost=findConsoleProxyHost(startupCmd);
    assert(consoleProxyHost != null);
    Answer answer=_agentMgr.send(consoleProxyHost.getId(),cmd);
    if (answer == null || !answer.getResult()) {
      s_logger.error("String_Node_Str");
    }
 else {
      s_logger.info("String_Node_Str");
    }
  }
 catch (  AgentUnavailableException e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
catch (  OperationTimedoutException e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
catch (  OutOfMemoryError e) {
    s_logger.error("String_Node_Str");
    System.exit(1);
  }
catch (  Exception e) {
    s_logger.error("String_Node_Str" + startupCmd.getProxyVmId(),e);
  }
}
Program: 106001
Project: 106001
Buggy source:
@Override public String getUuid(){
  return this.uuid;
}

Fixed version (ground truth):
@Override public String getUuid(){
  return uuid;
}
Program: 106002
Project: 106002
Buggy source:
@Override public boolean equals(Object obj){
  if (obj instanceof DedicatedResourceVO) {
    return ((DedicatedResourceVO)obj).getId() == this.getId();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj instanceof DedicatedResourceVO) {
    return ((DedicatedResourceVO)obj).getId() == getId();
  }
 else {
    return false;
  }
}
Program: 106003
Project: 106003
Buggy source:
public DedicatedResourceVO(long dedicatedResourceId){
  this.id=dedicatedResourceId;
}

Fixed version (ground truth):
public DedicatedResourceVO(long dedicatedResourceId){
  id=dedicatedResourceId;
}
Program: 106004
Project: 106004
Buggy source:
@Override public boolean isPortableIpTransferableFromNetwork(long ipAddrId,long networkId){
  Network network=_networksDao.findById(networkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  IPAddressVO ip=_ipAddressDao.findById(ipAddrId);
  if (ip == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  List<PublicIpAddress> ipList=new ArrayList<PublicIpAddress>();
  PublicIp publicIp=PublicIp.createFromAddrAndVlan(ip,_vlanDao.findById(ip.getVlanId()));
  ipList.add(publicIp);
  Map<PublicIpAddress,Set<Service>> ipToServices=_networkModel.getIpToServices(ipList,false,true);
  if (ipToServices != null & !ipToServices.isEmpty()) {
    Set<Service> ipServices=ipToServices.get(publicIp);
    if (ipServices != null && !ipServices.isEmpty()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isPortableIpTransferableFromNetwork(long ipAddrId,long networkId){
  Network network=_networksDao.findById(networkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  IPAddressVO ip=_ipAddressDao.findById(ipAddrId);
  if (ip == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  List<PublicIpAddress> ipList=new ArrayList<PublicIpAddress>();
  PublicIp publicIp=PublicIp.createFromAddrAndVlan(ip,_vlanDao.findById(ip.getVlanId()));
  ipList.add(publicIp);
  Map<PublicIpAddress,Set<Service>> ipToServices=_networkModel.getIpToServices(ipList,false,true);
  if (ipToServices != null && !ipToServices.isEmpty()) {
    Set<Service> ipServices=ipToServices.get(publicIp);
    if (ipServices != null && !ipServices.isEmpty()) {
      return false;
    }
  }
  return true;
}
Program: 106007
Project: 106007
Buggy source:
@Override @DB public boolean disassociatePublicIpAddress(long addrId,long userId,Account caller){
}

Fixed version (ground truth):
@Override @DB public boolean disassociatePublicIpAddress(long addrId,long userId,Account caller){
  boolean success=true;
  if (!cleanupIpResources(addrId,userId,caller)) {
    success=false;
    s_logger.warn("String_Node_Str" + addrId);
  }
  IPAddressVO ip=markIpAsUnavailable(addrId);
  if (ip == null) {
    String msg="String_Node_Str" + addrId + "String_Node_Str";
    s_logger.error(msg);
    return true;
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + addrId + "String_Node_Str"+ ip.isSourceNat());
  }
  if (ip.getAssociatedWithNetworkId() != null) {
    Network network=_networksDao.findById(ip.getAssociatedWithNetworkId());
    try {
      if (!applyIpAssociations(network,true)) {
        s_logger.warn("String_Node_Str" + network);
        success=false;
      }
    }
 catch (    ResourceUnavailableException e) {
      throw new CloudRuntimeException("String_Node_Str",e);
    }
  }
 else {
    if (ip.getState() == IpAddress.State.Releasing) {
      _ipAddressDao.unassignIpAddress(ip.getId());
    }
  }
  if (success) {
    if (ip.isPortable()) {
      releasePortableIpAddress(addrId);
    }
    s_logger.debug("String_Node_Str" + addrId);
  }
  return success;
}
Program: 106009
Project: 106009
Buggy source:
@DB @Override public PublicIp assignDedicateIpAddress(Account owner,final Long guestNtwkId,final Long vpcId,final long dcId,final boolean isSourceNat) throws ConcurrentOperationException, InsufficientAddressCapacityException {
  final long ownerId=owner.getId();
  PublicIp ip=null;
  try {
    ip=Transaction.execute(new TransactionCallbackWithException<PublicIp,InsufficientAddressCapacityException>(){
      @Override public PublicIp doInTransaction(      TransactionStatus status) throws InsufficientAddressCapacityException {
        Account owner=_accountDao.acquireInLockTable(ownerId);
        if (owner == null) {
          ConcurrentOperationException ex=new ConcurrentOperationException("String_Node_Str");
          throw ex;
        }
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + ownerId + "String_Node_Str");
        }
        PublicIp ip=fetchNewPublicIp(dcId,null,null,owner,VlanType.VirtualNetwork,guestNtwkId,isSourceNat,false,null,false,vpcId);
        IPAddressVO publicIp=ip.ip();
        markPublicIpAsAllocated(publicIp);
        _ipAddressDao.update(publicIp.getId(),publicIp);
        return ip;
      }
    }
);
    return ip;
  }
  finally {
    if (owner != null) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + ownerId);
      }
      _accountDao.releaseFromLockTable(ownerId);
    }
    if (ip == null) {
      s_logger.error("String_Node_Str" + ownerId);
    }
  }
}

Fixed version (ground truth):
@DB @Override public PublicIp assignDedicateIpAddress(Account owner,final Long guestNtwkId,final Long vpcId,final long dcId,final boolean isSourceNat) throws ConcurrentOperationException, InsufficientAddressCapacityException {
  if (owner == null) {
    s_logger.error("String_Node_Str");
    return null;
  }
  final long ownerId=owner.getId();
  PublicIp ip=null;
  try {
    ip=Transaction.execute(new TransactionCallbackWithException<PublicIp,InsufficientAddressCapacityException>(){
      @Override public PublicIp doInTransaction(      TransactionStatus status) throws InsufficientAddressCapacityException {
        Account owner=_accountDao.acquireInLockTable(ownerId);
        if (owner == null) {
          ConcurrentOperationException ex=new ConcurrentOperationException("String_Node_Str");
          throw ex;
        }
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + ownerId + "String_Node_Str");
        }
        PublicIp ip=fetchNewPublicIp(dcId,null,null,owner,VlanType.VirtualNetwork,guestNtwkId,isSourceNat,false,null,false,vpcId);
        IPAddressVO publicIp=ip.ip();
        markPublicIpAsAllocated(publicIp);
        _ipAddressDao.update(publicIp.getId(),publicIp);
        return ip;
      }
    }
);
    return ip;
  }
  finally {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + ownerId);
    }
    _accountDao.releaseFromLockTable(ownerId);
    if (ip == null) {
      s_logger.error("String_Node_Str" + ownerId);
    }
  }
}
Program: 106010
Project: 106010
Buggy source:
@Override public Map<Service,Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<NetworkOfferingServiceMapVO> map=_ntwkOfferingSrvcDao.listByNetworkOfferingId(networkOfferingId);
  for (  NetworkOfferingServiceMapVO instance : map) {
    String service=instance.getService();
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(Service.getService(service),providers);
  }
  return serviceProviderMap;
}

Fixed version (ground truth):
@Override public Map<Service,Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<NetworkOfferingServiceMapVO> map=_ntwkOfferingSrvcDao.listByNetworkOfferingId(networkOfferingId);
  for (  NetworkOfferingServiceMapVO instance : map) {
    Service service=Network.Service.getService(instance.getService());
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(service,providers);
  }
  return serviceProviderMap;
}
Program: 106011
Project: 106011
Buggy source:
@Override public void checkNetworkPermissions(Account owner,Network network){
  if (network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
    AccountVO networkOwner=_accountDao.findById(network.getAccountId());
    if (networkOwner == null)     throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
    if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      if (!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(),network.getAccountId())) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
 else {
      List<NetworkVO> networkMap=_networksDao.listBy(owner.getId(),network.getId());
      if (networkMap == null || networkMap.isEmpty()) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
  }
 else {
    if (!isNetworkAvailableInDomain(network.getId(),owner.getDomainId())) {
      throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str"+ owner.getDomainId());
    }
  }
}

Fixed version (ground truth):
@Override public void checkNetworkPermissions(Account owner,Network network){
  if (network == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  if (network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
    AccountVO networkOwner=_accountDao.findById(network.getAccountId());
    if (networkOwner == null)     throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
    if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      if (!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(),network.getAccountId())) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
 else {
      List<NetworkVO> networkMap=_networksDao.listBy(owner.getId(),network.getId());
      if (networkMap == null || networkMap.isEmpty()) {
        throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str");
      }
    }
  }
 else {
    if (!isNetworkAvailableInDomain(network.getId(),owner.getDomainId())) {
      throw new PermissionDeniedException("String_Node_Str" + ((network != null) ? ((NetworkVO)network).getUuid() : "String_Node_Str") + "String_Node_Str"+ owner.getDomainId());
    }
  }
}
Program: 106012
Project: 106012
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  Map<String,String> dbParams=_configDao.getConfiguration(params);
  _cidr=dbParams.get(Config.ControlCidr);
  if (_cidr == null) {
    _cidr="String_Node_Str";
  }
  _gateway=dbParams.get(Config.ControlGateway);
  if (_gateway == null) {
    _gateway=NetUtils.getLinkLocalGateway();
  }
  s_logger.info("String_Node_Str" + _cidr + "String_Node_Str"+ _gateway);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  super.configure(name,params);
  Map<String,String> dbParams=_configDao.getConfiguration(params);
  _cidr=dbParams.get(Config.ControlCidr.toString());
  if (_cidr == null) {
    _cidr="String_Node_Str";
  }
  _gateway=dbParams.get(Config.ControlGateway.toString());
  if (_gateway == null) {
    _gateway=NetUtils.getLinkLocalGateway();
  }
  s_logger.info("String_Node_Str" + _cidr + "String_Node_Str"+ _gateway);
  return true;
}
Program: 106013
Project: 106013
Buggy source:
@Override public Map<Service,Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<VpcOfferingServiceMapVO> map=_vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
  for (  VpcOfferingServiceMapVO instance : map) {
    String service=instance.getService();
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(Service.getService(service),providers);
  }
  return serviceProviderMap;
}

Fixed version (ground truth):
@Override public Map<Service,Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId){
  Map<Service,Set<Provider>> serviceProviderMap=new HashMap<Service,Set<Provider>>();
  List<VpcOfferingServiceMapVO> map=_vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
  for (  VpcOfferingServiceMapVO instance : map) {
    Service service=Service.getService(instance.getService());
    Set<Provider> providers;
    providers=serviceProviderMap.get(service);
    if (providers == null) {
      providers=new HashSet<Provider>();
    }
    providers.add(Provider.getProvider(instance.getProvider()));
    serviceProviderMap.put(service,providers);
  }
  return serviceProviderMap;
}
Program: 106016
Project: 106016
Buggy source:
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficType,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel);

Fixed version (ground truth):
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficType,String isolationMethod,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel);
Program: 106017
Project: 106017
Buggy source:
@Override public void create() throws ResourceAllocationException {
  PhysicalNetworkTrafficType result=_networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(),getTrafficType(),getXenLabel(),getKvmLabel(),getVmwareLabel(),getSimulatorLabel(),getVlan(),getHypervLabel());
  if (result != null) {
    setEntityId(result.getId());
    setEntityUuid(result.getUuid());
  }
 else {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void create() throws ResourceAllocationException {
  PhysicalNetworkTrafficType result=_networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(),getTrafficType(),getIsolationMethod(),getXenLabel(),getKvmLabel(),getVmwareLabel(),getSimulatorLabel(),getVlan(),getHypervLabel());
  if (result != null) {
    setEntityId(result.getId());
    setEntityUuid(result.getUuid());
  }
 else {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
}
Program: 106021
Project: 106021
Buggy source:
protected void getIp(NicProfile nic,DataCenter dc,VirtualMachineProfile vm,Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  if (nic.getIp4Address() == null) {
    PublicIp ip=_ipAddrMgr.assignPublicIpAddress(dc.getId(),null,vm.getOwner(),VlanType.VirtualNetwork,null,null,false);
    nic.setIp4Address(ip.getAddress().toString());
    nic.setGateway(ip.getGateway());
    nic.setNetmask(ip.getNetmask());
    nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
    nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
    nic.setBroadcastType(BroadcastDomainType.Vlan);
    nic.setFormat(AddressFormat.Ip4);
    nic.setReservationId(String.valueOf(ip.getVlanTag()));
    nic.setMacAddress(ip.getMacAddress());
  }
  nic.setDns1(dc.getDns1());
  nic.setDns2(dc.getDns2());
}

Fixed version (ground truth):
protected void getIp(NicProfile nic,DataCenter dc,VirtualMachineProfile vm,Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  if (nic.getIp4Address() == null) {
    PublicIp ip=_ipAddrMgr.assignPublicIpAddress(dc.getId(),null,vm.getOwner(),VlanType.VirtualNetwork,null,null,false);
    nic.setIp4Address(ip.getAddress().toString());
    nic.setGateway(ip.getGateway());
    nic.setNetmask(ip.getNetmask());
    if (network.getBroadcastDomainType() == BroadcastDomainType.Vxlan) {
      nic.setIsolationUri(BroadcastDomainType.Vxlan.toUri(ip.getVlanTag()));
      nic.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(ip.getVlanTag()));
      nic.setBroadcastType(BroadcastDomainType.Vxlan);
    }
 else {
      nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
      nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
      nic.setBroadcastType(BroadcastDomainType.Vlan);
    }
    nic.setFormat(AddressFormat.Ip4);
    nic.setReservationId(String.valueOf(ip.getVlanTag()));
    nic.setMacAddress(ip.getMacAddress());
  }
  nic.setDns1(dc.getDns1());
  nic.setDns2(dc.getDns2());
}
Program: 106022
Project: 106022
Buggy source:
@Override public Network design(NetworkOffering offering,DeploymentPlan plan,Network network,Account owner){
  if (!canHandle(offering)) {
    return null;
  }
  if (offering.getTrafficType() == TrafficType.Public) {
    NetworkVO ntwk=new NetworkVO(offering.getTrafficType(),Mode.Static,BroadcastDomainType.Vlan,offering.getId(),State.Setup,plan.getDataCenterId(),plan.getPhysicalNetworkId());
    return ntwk;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Network design(NetworkOffering offering,DeploymentPlan plan,Network network,Account owner){
  if (!canHandle(offering)) {
    return null;
  }
  if (offering.getTrafficType() == TrafficType.Public) {
    NetworkVO ntwk=new NetworkVO(offering.getTrafficType(),Mode.Static,network.getBroadcastDomainType(),offering.getId(),State.Setup,plan.getDataCenterId(),plan.getPhysicalNetworkId());
    return ntwk;
  }
 else {
    return null;
  }
}
Program: 106024
Project: 106024
Buggy source:
@Override public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficType,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel){
  return null;
}

Fixed version (ground truth):
@Override public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficType,String isolationMethod,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel){
  return null;
}
Program: 106027
Project: 106027
Buggy source:
@Override public boolean disconnectPhysicalDiskByPath(String localPath){
  String poolUuid=null;
  if (localPath != null && localPath.startsWith(_mountPoint) && localPath.endsWith("String_Node_Str")) {
    String[] token=localPath.split("String_Node_Str");
    if (token.length > 3) {
      poolUuid=token[2];
    }
  }
 else {
    return false;
  }
  if (poolUuid == null) {
    return false;
  }
  try {
    Connect conn=LibvirtConnection.getConnection();
    StoragePool pool=conn.storagePoolLookupByUUIDString(poolUuid);
    deleteStoragePool(poolUuid);
    return true;
  }
 catch (  LibvirtException ex) {
    return false;
  }
catch (  CloudRuntimeException ex) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean disconnectPhysicalDiskByPath(String localPath){
  String poolUuid=null;
  if (localPath != null && localPath.startsWith(_mountPoint) && localPath.endsWith("String_Node_Str")) {
    String[] token=localPath.split("String_Node_Str");
    if (token.length > 3) {
      poolUuid=token[2];
    }
  }
 else {
    return false;
  }
  if (poolUuid == null) {
    return false;
  }
  try {
    Connect conn=LibvirtConnection.getConnection();
    conn.storagePoolLookupByUUIDString(poolUuid);
    deleteStoragePool(poolUuid);
    return true;
  }
 catch (  LibvirtException ex) {
    return false;
  }
catch (  CloudRuntimeException ex) {
    return false;
  }
}
Program: 106028
Project: 106028
Buggy source:
@Override public boolean deletePhysicalDisk(String uuid,KVMStoragePool pool){
  if (pool.getType() == StoragePoolType.RBD) {
    try {
      s_logger.info("String_Node_Str" + pool.getSourcePort() + "String_Node_Str"+ uuid+ "String_Node_Str");
      Rados r=new Rados(pool.getAuthUserName());
      r.confSet("String_Node_Str",pool.getSourceHost() + "String_Node_Str" + pool.getSourcePort());
      r.confSet("String_Node_Str",pool.getAuthSecret());
      r.connect();
      s_logger.debug("String_Node_Str" + r.confGet("String_Node_Str"));
      IoCTX io=r.ioCtxCreate(pool.getSourceDir());
      Rbd rbd=new Rbd(io);
      RbdImage image=rbd.open(uuid);
      List<RbdSnapInfo> snaps=image.snapList();
      for (      RbdSnapInfo snap : snaps) {
        image.snapUnprotect(snap.name);
        image.snapRemove(snap.name);
      }
      rbd.close(image);
      r.ioCtxDestroy(io);
    }
 catch (    RadosException e) {
      throw new CloudRuntimeException(e.toString());
    }
catch (    RbdException e) {
      throw new CloudRuntimeException(e.toString());
    }
  }
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  try {
    StorageVol vol=this.getVolume(libvirtPool.getPool(),uuid);
    deleteVol(libvirtPool,vol);
    vol.free();
    return true;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}

Fixed version (ground truth):
@Override public boolean deletePhysicalDisk(String uuid,KVMStoragePool pool){
  if (pool.getType() == StoragePoolType.RBD) {
    try {
      s_logger.info("String_Node_Str" + pool.getSourcePort() + "String_Node_Str"+ uuid+ "String_Node_Str");
      Rados r=new Rados(pool.getAuthUserName());
      r.confSet("String_Node_Str",pool.getSourceHost() + "String_Node_Str" + pool.getSourcePort());
      r.confSet("String_Node_Str",pool.getAuthSecret());
      r.connect();
      s_logger.debug("String_Node_Str" + r.confGet("String_Node_Str"));
      IoCTX io=r.ioCtxCreate(pool.getSourceDir());
      Rbd rbd=new Rbd(io);
      RbdImage image=rbd.open(uuid);
      List<RbdSnapInfo> snaps=image.snapList();
      for (      RbdSnapInfo snap : snaps) {
        image.snapUnprotect(snap.name);
        image.snapRemove(snap.name);
      }
      rbd.close(image);
      r.ioCtxDestroy(io);
    }
 catch (    RadosException e) {
      throw new CloudRuntimeException(e.toString());
    }
catch (    RbdException e) {
      throw new CloudRuntimeException(e.toString());
    }
  }
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  try {
    StorageVol vol=getVolume(libvirtPool.getPool(),uuid);
    deleteVol(libvirtPool,vol);
    vol.free();
    return true;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}
Program: 106031
Project: 106031
Buggy source:
@Override public List<KVMPhysicalDisk> listPhysicalDisks(String storagePoolUuid,KVMStoragePool pool){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  StoragePool virtPool=libvirtPool.getPool();
  List<KVMPhysicalDisk> disks=new ArrayList<KVMPhysicalDisk>();
  try {
    String[] vols=virtPool.listVolumes();
    for (    String volName : vols) {
      KVMPhysicalDisk disk=this.getPhysicalDisk(volName,pool);
      disks.add(disk);
    }
    return disks;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}

Fixed version (ground truth):
@Override public List<KVMPhysicalDisk> listPhysicalDisks(String storagePoolUuid,KVMStoragePool pool){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  StoragePool virtPool=libvirtPool.getPool();
  List<KVMPhysicalDisk> disks=new ArrayList<KVMPhysicalDisk>();
  try {
    String[] vols=virtPool.listVolumes();
    for (    String volName : vols) {
      KVMPhysicalDisk disk=getPhysicalDisk(volName,pool);
      disks.add(disk);
    }
    return disks;
  }
 catch (  LibvirtException e) {
    throw new CloudRuntimeException(e.toString());
  }
}
Program: 106032
Project: 106032
Buggy source:
public static supersetOrSubset isNetowrkASubsetOrSupersetOfNetworkB(String cidrA,String cidrB){
  Long[] cidrALong=cidrToLong(cidrA);
  Long[] cidrBLong=cidrToLong(cidrB);
  long shift=0;
  if (cidrALong == null || cidrBLong == null) {
    return supersetOrSubset.errorInCidrFormat;
  }
  if (cidrALong[1] >= cidrBLong[1]) {
    shift=32 - cidrBLong[1];
  }
 else {
    shift=32 - cidrALong[1];
  }
  long result=(cidrALong[0] >> shift) - (cidrBLong[0] >> shift);
  if (result == 0) {
    if (cidrALong[1] < cidrBLong[1]) {
      return supersetOrSubset.isSuperset;
    }
 else     if (cidrALong[1] == cidrBLong[1]) {
      return supersetOrSubset.sameSubnet;
    }
    return supersetOrSubset.isSubset;
  }
  return supersetOrSubset.neitherSubetNorSuperset;
}

Fixed version (ground truth):
public static supersetOrSubset isNetowrkASubsetOrSupersetOfNetworkB(String cidrA,String cidrB){
  Long[] cidrALong=cidrToLong(cidrA);
  Long[] cidrBLong=cidrToLong(cidrB);
  long shift=0;
  if (cidrALong == null || cidrBLong == null) {
    return supersetOrSubset.errorInCidrFormat;
  }
  if (cidrALong[1] >= cidrBLong[1]) {
    shift=32 - cidrBLong[1];
  }
 else {
    shift=32 - cidrALong[1];
  }
  long result=(cidrALong[0] >> shift) - (cidrBLong[0] >> shift);
  if (result == 0) {
    if (cidrALong[1] < cidrBLong[1]) {
      return supersetOrSubset.isSuperset;
    }
 else     if (cidrALong[1].equals(cidrBLong[1])) {
      return supersetOrSubset.sameSubnet;
    }
    return supersetOrSubset.isSubset;
  }
  return supersetOrSubset.neitherSubetNorSuperset;
}
Program: 106033
Project: 106033
Buggy source:
public static boolean isValidIp6Cidr(String ip6Cidr){
  try {
    IPv6Network network=IPv6Network.fromString(ip6Cidr);
  }
 catch (  IllegalArgumentException ex) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean isValidIp6Cidr(String ip6Cidr){
  try {
    IPv6Network.fromString(ip6Cidr);
  }
 catch (  IllegalArgumentException ex) {
    return false;
  }
  return true;
}
Program: 106034
Project: 106034
Buggy source:
public static boolean isValidIpv6(String ip){
  try {
    IPv6Address address=IPv6Address.fromString(ip);
  }
 catch (  IllegalArgumentException ex) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean isValidIpv6(String ip){
  try {
    IPv6Address.fromString(ip);
  }
 catch (  IllegalArgumentException ex) {
    return false;
  }
  return true;
}
Program: 106035
Project: 106035
Buggy source:
public String searchFileInSubFolders(String fileName,boolean caseInsensitive) throws Exception {
  String datastorePath="String_Node_Str" + getName() + "String_Node_Str";
  String rootDirectoryFilePath=String.format("String_Node_Str",datastorePath,fileName);
  if (fileExists(rootDirectoryFilePath)) {
    return rootDirectoryFilePath;
  }
  String parentFolderPath=null;
  String absoluteFileName=null;
  s_logger.info("String_Node_Str" + fileName + "String_Node_Str"+ datastorePath);
  HostDatastoreBrowserMO browserMo=getHostDatastoreBrowserMO();
  ArrayList<HostDatastoreBrowserSearchResults> results=browserMo.searchDatastoreSubFolders("String_Node_Str" + getName() + "String_Node_Str",fileName,caseInsensitive);
  if (results != null && results.size() > 1) {
    s_logger.warn("String_Node_Str" + fileName + "String_Node_Str"+ datastorePath+ "String_Node_Str");
  }
  for (  HostDatastoreBrowserSearchResults result : results) {
    List<FileInfo> info=result.getFile();
    if (info != null && info.size() > 0) {
      for (      FileInfo fi : info) {
        absoluteFileName=parentFolderPath=result.getFolderPath();
        s_logger.info("String_Node_Str" + fileName + "String_Node_Str"+ absoluteFileName);
        if (parentFolderPath.endsWith("String_Node_Str"))         absoluteFileName+="String_Node_Str";
        absoluteFileName+=fi.getPath();
        break;
      }
    }
  }
  return absoluteFileName;
}

Fixed version (ground truth):
public String searchFileInSubFolders(String fileName,boolean caseInsensitive) throws Exception {
  String datastorePath="String_Node_Str" + getName() + "String_Node_Str";
  String rootDirectoryFilePath=String.format("String_Node_Str",datastorePath,fileName);
  if (fileExists(rootDirectoryFilePath)) {
    return rootDirectoryFilePath;
  }
  String parentFolderPath=null;
  String absoluteFileName=null;
  s_logger.info("String_Node_Str" + fileName + "String_Node_Str"+ datastorePath);
  HostDatastoreBrowserMO browserMo=getHostDatastoreBrowserMO();
  ArrayList<HostDatastoreBrowserSearchResults> results=browserMo.searchDatastoreSubFolders("String_Node_Str" + getName() + "String_Node_Str",fileName,caseInsensitive);
  if (results != null && results.size() > 1) {
    s_logger.warn("String_Node_Str" + fileName + "String_Node_Str"+ datastorePath+ "String_Node_Str");
  }
 else   if (results == null) {
    String msg="String_Node_Str" + fileName + "String_Node_Str"+ datastorePath;
    s_logger.error(msg);
    throw new CloudException(msg);
  }
  for (  HostDatastoreBrowserSearchResults result : results) {
    List<FileInfo> info=result.getFile();
    if (info != null && info.size() > 0) {
      for (      FileInfo fi : info) {
        absoluteFileName=parentFolderPath=result.getFolderPath();
        s_logger.info("String_Node_Str" + fileName + "String_Node_Str"+ absoluteFileName);
        if (parentFolderPath.endsWith("String_Node_Str"))         absoluteFileName+="String_Node_Str";
        absoluteFileName+=fi.getPath();
        break;
      }
    }
  }
  return absoluteFileName;
}
Program: 106036
Project: 106036
Buggy source:
@Override public int compare(DiskTO arg0,DiskTO arg1){
  if (arg0.getDiskSeq() < arg1.getDiskSeq()) {
    return -1;
  }
 else   if (arg0.getDiskSeq() == arg1.getDiskSeq()) {
    return 0;
  }
  return 1;
}

Fixed version (ground truth):
@Override public int compare(DiskTO arg0,DiskTO arg1){
  if (arg0.getDiskSeq() < arg1.getDiskSeq()) {
    return -1;
  }
 else   if (arg0.getDiskSeq().equals(arg1.getDiskSeq())) {
    return 0;
  }
  return 1;
}