nus-yam/ex-repair huggingface dataset:
Program: 46498
Project: 46498
Buggy source:
/** 
 * Gets cache name by adding manager prefix.
 * @param name pure cache name with prefix
 * @return the cache name with manager prefix
 */
String getCacheNameWithPrefix(String name);

Fixed version (ground truth):
/** 
 * Gets cache name by adding manager prefix.
 * @param name pure cache name without prefix
 * @return the cache name with manager prefix
 */
String getCacheNameWithPrefix(String name);
Program: 46499
Project: 46499
Buggy source:
public void destroy(){
  close();
  if (!isDestroyed.compareAndSet(false,true)) {
    return;
  }
  isClosed.set(true);
  Operation operation=new CacheDestroyOperation(cacheConfig.getNameWithPrefix());
  int partitionId=getNodeEngine().getPartitionService().getPartitionId(getDistributedObjectName());
  OperationService operationService=getNodeEngine().getOperationService();
  InternalCompletableFuture f=operationService.invokeOnPartition(CacheService.SERVICE_NAME,operation,partitionId);
  f.getSafely();
  cacheService.deleteCache(getDistributedObjectName(),true,null,true);
  f.getSafely();
}

Fixed version (ground truth):
public void destroy(){
  close();
  if (!isDestroyed.compareAndSet(false,true)) {
    return;
  }
  isClosed.set(true);
  Operation operation=new CacheDestroyOperation(cacheConfig.getNameWithPrefix());
  int partitionId=getNodeEngine().getPartitionService().getPartitionId(getDistributedObjectName());
  OperationService operationService=getNodeEngine().getOperationService();
  InternalCompletableFuture f=operationService.invokeOnPartition(CacheService.SERVICE_NAME,operation,partitionId);
  f.getSafely();
  cacheService.deleteCache(getDistributedObjectName(),true,null,true);
  f.getSafely();
  postDestroy();
}
Program: 46500
Project: 46500
Buggy source:
@Override public void destroyCache(String cacheName){
  checkIfManagerNotClosed();
  checkNotNull(cacheName,"String_Node_Str");
  String cacheNameWithPrefix=getCacheNameWithPrefix(cacheName);
  ICacheInternal<?,?> cache=caches.remove(cacheNameWithPrefix);
  if (cache != null) {
    cache.destroy();
  }
  removeCacheConfigFromLocal(cacheNameWithPrefix);
}

Fixed version (ground truth):
@Override public void destroyCache(String cacheName){
  removeCache(cacheName,true);
}
Program: 46501
Project: 46501
Buggy source:
@Test public void getButCantOperateOnCacheAfterDestroy(){
  String cacheName=randomString();
  ICache<Integer,Integer> cache=createCache(cacheName);
  cache.destroy();
  assertTrue(cache.isClosed());
  assertTrue(cache.isDestroyed());
  Cache<Object,Object> cacheAfterClose=cacheManager.getCache(cacheName);
  assertNotNull(cacheAfterClose);
  assertTrue(cache.isClosed());
  assertTrue(cache.isDestroyed());
  try {
    cache.put(1,1);
    fail("String_Node_Str");
  }
 catch (  IllegalStateException e) {
  }
catch (  Throwable t) {
    t.printStackTrace();
    fail("String_Node_Str" + "String_Node_Str" + t.getMessage());
  }
}

Fixed version (ground truth):
@Test public void getButCantOperateOnCacheAfterDestroy(){
  String cacheName=randomString();
  ICache<Integer,Integer> cache=createCache(cacheName);
  cache.destroy();
  assertTrue(cache.isClosed());
  assertTrue(cache.isDestroyed());
  Cache<Object,Object> cacheAfterDestroy=cacheManager.getCache(cacheName);
  assertNull(cacheAfterDestroy);
  assertTrue(cache.isClosed());
  assertTrue(cache.isDestroyed());
  try {
    cache.put(1,1);
    fail("String_Node_Str");
  }
 catch (  IllegalStateException e) {
  }
catch (  Throwable t) {
    t.printStackTrace();
    fail("String_Node_Str" + "String_Node_Str" + t.getMessage());
  }
}
Program: 46502
Project: 46502
Buggy source:
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}

Fixed version (ground truth):
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=getAdjustedExpireTime(expiryDuration,now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}
Program: 46503
Project: 46503
Buggy source:
protected R createRecordWithExpiry(Data key,Object value,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  Duration expiryDuration;
  try {
    expiryDuration=expiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=expiryDuration.getAdjustedTime(now);
  return createRecordWithExpiry(key,value,expiryTime,now,disableWriteThrough,completionId,origin);
}

Fixed version (ground truth):
protected R createRecordWithExpiry(Data key,Object value,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  Duration expiryDuration;
  try {
    expiryDuration=expiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=getAdjustedExpireTime(expiryDuration,now);
  return createRecordWithExpiry(key,value,expiryTime,now,disableWriteThrough,completionId,origin);
}
Program: 46504
Project: 46504
Buggy source:
public R readThroughRecord(Data key,long now){
  Object value=readThroughCache(key);
  if (value == null) {
    return null;
  }
  Duration expiryDuration;
  try {
    expiryDuration=defaultExpiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=expiryDuration.getAdjustedTime(now);
  if (isExpiredAt(expiryTime,now)) {
    return null;
  }
  return createRecord(key,value,expiryTime,IGNORE_COMPLETION);
}

Fixed version (ground truth):
public R readThroughRecord(Data key,long now){
  Object value=readThroughCache(key);
  if (value == null) {
    return null;
  }
  Duration expiryDuration;
  try {
    expiryDuration=defaultExpiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=getAdjustedExpireTime(expiryDuration,now);
  if (isExpiredAt(expiryTime,now)) {
    return null;
  }
  return createRecord(key,value,expiryTime,IGNORE_COMPLETION);
}
Program: 46505
Project: 46505
Buggy source:
protected boolean updateRecordWithExpiry(Data key,Object value,R record,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String source,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForUpdate();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return updateRecordWithExpiry(key,value,record,expiryTime,now,disableWriteThrough,completionId,source,origin);
}

Fixed version (ground truth):
protected boolean updateRecordWithExpiry(Data key,Object value,R record,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String source,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForUpdate();
    if (expiryDuration != null) {
      expiryTime=getAdjustedExpireTime(expiryDuration,now);
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return updateRecordWithExpiry(key,value,record,expiryTime,now,disableWriteThrough,completionId,source,origin);
}
Program: 46506
Project: 46506
Buggy source:
public MulticastMemberInfo receive(){
  try {
    Object o;
    multicastSocket.receive(datagramPacketReceive);
    byte[] data=datagramPacketReceive.getData();
    MulticastMemberInfo multicastMemberInfo;
    ByteArrayInputStream bis=new ByteArrayInputStream(data);
    ObjectInputStream in;
    in=new ObjectInputStream(bis);
    o=in.readObject();
    multicastMemberInfo=(MulticastMemberInfo)o;
    IOUtil.closeResource(bis);
    IOUtil.closeResource(in);
    return multicastMemberInfo;
  }
 catch (  Exception e) {
  }
  return null;
}

Fixed version (ground truth):
public MulticastMemberInfo receive(){
  ObjectInputStream in=null;
  ByteArrayInputStream bis=null;
  try {
    Object o;
    multicastSocket.receive(datagramPacketReceive);
    byte[] data=datagramPacketReceive.getData();
    MulticastMemberInfo multicastMemberInfo;
    bis=new ByteArrayInputStream(data);
    in=new ObjectInputStream(bis);
    o=in.readObject();
    multicastMemberInfo=(MulticastMemberInfo)o;
    return multicastMemberInfo;
  }
 catch (  Exception e) {
    logger.finest("String_Node_Str" + e.getMessage());
  }
 finally {
    IOUtil.closeResource(bis);
    IOUtil.closeResource(in);
  }
  return null;
}
Program: 46507
Project: 46507
Buggy source:
public MulticastDiscoveryReceiver(MulticastSocket multicastSocket){
  this.multicastSocket=multicastSocket;
}

Fixed version (ground truth):
public MulticastDiscoveryReceiver(MulticastSocket multicastSocket,ILogger logger){
  this.multicastSocket=multicastSocket;
  this.logger=logger;
}
Program: 46508
Project: 46508
Buggy source:
public MulticastDiscoverySender(DiscoveryNode discoveryNode,MulticastSocket multicastSocket) throws IOException {
  this.discoveryNode=discoveryNode;
  this.multicastSocket=multicastSocket;
  if (discoveryNode != null) {
    multicastMemberInfo=new MulticastMemberInfo(discoveryNode.getPublicAddress().getHost(),discoveryNode.getPublicAddress().getPort());
  }
  initDatagramPacket();
}

Fixed version (ground truth):
public MulticastDiscoverySender(DiscoveryNode discoveryNode,MulticastSocket multicastSocket,ILogger logger) throws IOException {
  this.multicastSocket=multicastSocket;
  this.logger=logger;
  if (discoveryNode != null) {
    Address address=discoveryNode.getPublicAddress();
    multicastMemberInfo=new MulticastMemberInfo(address.getHost(),address.getPort());
  }
  initDatagramPacket();
}
Program: 46509
Project: 46509
Buggy source:
private void initDatagramPacket() throws IOException {
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutput out;
  out=new ObjectOutputStream(bos);
  out.writeObject(multicastMemberInfo);
  byte[] yourBytes=bos.toByteArray();
  datagramPacket=new DatagramPacket(yourBytes,yourBytes.length,InetAddress.getByName("String_Node_Str"),54327);
}

Fixed version (ground truth):
private void initDatagramPacket() throws IOException {
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutput out;
  out=new ObjectOutputStream(bos);
  out.writeObject(multicastMemberInfo);
  byte[] yourBytes=bos.toByteArray();
  datagramPacket=new DatagramPacket(yourBytes,yourBytes.length,multicastSocket.getInetAddress(),multicastSocket.getPort());
}
Program: 46510
Project: 46510
Buggy source:
@Override public void run(){
  while (!stop) {
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    try {
      send();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stop) {
    try {
      Thread.sleep(SLEEP_DURATION);
    }
 catch (    InterruptedException e) {
      logger.finest("String_Node_Str");
    }
    try {
      send();
    }
 catch (    IOException e) {
      logger.finest(e.getMessage());
    }
  }
}
Program: 46511
Project: 46511
Buggy source:
private void initializeMulticastSocket(){
  try {
    int port=getOrDefault(MulticastProperties.PORT,54327);
    String group=getOrDefault(MulticastProperties.GROUP,"String_Node_Str");
    multicastSocket=new MulticastSocket(port);
    multicastSocket.setReuseAddress(true);
    multicastSocket.setTimeToLive(255);
    multicastSocket.setReceiveBufferSize(64 * DATA_OUTPUT_BUFFER_SIZE);
    multicastSocket.setSendBufferSize(64 * DATA_OUTPUT_BUFFER_SIZE);
    multicastSocket.setSoTimeout(3000);
    multicastSocket.joinGroup(InetAddress.getByName(group));
    multicastDiscoverySender=new MulticastDiscoverySender(discoveryNode,multicastSocket);
    multicastDiscoveryReceiver=new MulticastDiscoveryReceiver(multicastSocket);
    if (discoveryNode != null) {
      isClient=false;
    }
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
}

Fixed version (ground truth):
private void initializeMulticastSocket(){
  try {
    int port=getOrDefault(MulticastProperties.PORT,DEFAULT_MULTICAST_PORT);
    String group=getOrDefault(MulticastProperties.GROUP,DEFAULT_MULTICAST_GROUP);
    multicastSocket=new MulticastSocket(port);
    multicastSocket.setReuseAddress(true);
    multicastSocket.setTimeToLive(SOCKET_TIME_TO_LIVE);
    multicastSocket.setReceiveBufferSize(DATA_OUTPUT_BUFFER_SIZE);
    multicastSocket.setSendBufferSize(DATA_OUTPUT_BUFFER_SIZE);
    multicastSocket.setSoTimeout(SOCKET_TIMEOUT);
    multicastSocket.joinGroup(InetAddress.getByName(group));
    multicastDiscoverySender=new MulticastDiscoverySender(discoveryNode,multicastSocket,logger);
    multicastDiscoveryReceiver=new MulticastDiscoveryReceiver(multicastSocket,logger);
    if (discoveryNode != null) {
      isClient=false;
    }
  }
 catch (  Exception e) {
    logger.finest(e.getMessage());
  }
}
Program: 46512
Project: 46512
Buggy source:
@Override public Iterable<DiscoveryNode> discoverNodes(){
  DiscoveryNode discoveryNode;
  MulticastMemberInfo multicastMemberInfo=multicastDiscoveryReceiver.receive();
  if (multicastMemberInfo == null)   return null;
  ArrayList<DiscoveryNode> arrayList=new ArrayList<DiscoveryNode>();
  try {
    discoveryNode=new SimpleDiscoveryNode(new Address(multicastMemberInfo.getHost(),multicastMemberInfo.getPort()));
    arrayList.add(discoveryNode);
  }
 catch (  UnknownHostException e) {
    logger.warning(e.getMessage());
  }
  return arrayList;
}

Fixed version (ground truth):
@Override public Iterable<DiscoveryNode> discoverNodes(){
  DiscoveryNode discoveryNode;
  MulticastMemberInfo multicastMemberInfo=multicastDiscoveryReceiver.receive();
  if (multicastMemberInfo == null) {
    return null;
  }
  ArrayList<DiscoveryNode> arrayList=new ArrayList<DiscoveryNode>();
  try {
    discoveryNode=new SimpleDiscoveryNode(new Address(multicastMemberInfo.getHost(),multicastMemberInfo.getPort()));
    arrayList.add(discoveryNode);
  }
 catch (  UnknownHostException e) {
    logger.finest(e.getMessage());
  }
  return arrayList;
}
Program: 46513
Project: 46513
Buggy source:
public MulticastDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> properties){
  super(logger,properties);
  this.discoveryNode=discoveryNode;
  this.properties=properties;
  this.logger=logger;
}

Fixed version (ground truth):
public MulticastDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> properties){
  super(logger,properties);
  this.discoveryNode=discoveryNode;
  this.logger=logger;
}
Program: 46514
Project: 46514
Buggy source:
@Override public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> properties){
  return new MulticastDiscoveryStrategy(discoveryNode,logger,properties);
}

Fixed version (ground truth):
@Override public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,ILogger logger,Map<String,Comparable> prop){
  return new MulticastDiscoveryStrategy(discoveryNode,logger,prop);
}
Program: 46515
Project: 46515
Buggy source:
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}

Fixed version (ground truth):
protected long updateAccessDuration(Data key,R record,ExpiryPolicy expiryPolicy,long now){
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForAccess();
    if (expiryDuration != null) {
      expiryTime=getAdjustedExpireTime(expiryDuration,now);
      record.setExpirationTime(expiryTime);
      if (isEventsEnabled()) {
        CacheEventContext cacheEventContext=createBaseEventContext(CacheEventType.EXPIRATION_TIME_UPDATED,toEventData(key),toEventData(record.getValue()),expiryTime,null,IGNORE_COMPLETION);
        cacheEventContext.setAccessHit(record.getAccessHit());
        publishEvent(cacheEventContext);
      }
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return expiryTime;
}
Program: 46516
Project: 46516
Buggy source:
protected R createRecordWithExpiry(Data key,Object value,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  Duration expiryDuration;
  try {
    expiryDuration=expiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=expiryDuration.getAdjustedTime(now);
  return createRecordWithExpiry(key,value,expiryTime,now,disableWriteThrough,completionId,origin);
}

Fixed version (ground truth):
protected R createRecordWithExpiry(Data key,Object value,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  Duration expiryDuration;
  try {
    expiryDuration=expiryPolicy.getExpiryForCreation();
  }
 catch (  Exception e) {
    expiryDuration=Duration.ETERNAL;
  }
  long expiryTime=getAdjustedExpireTime(expiryDuration,now);
  return createRecordWithExpiry(key,value,expiryTime,now,disableWriteThrough,completionId,origin);
}
Program: 46517
Project: 46517
Buggy source:
protected boolean updateRecordWithExpiry(Data key,Object value,R record,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String source,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForUpdate();
    if (expiryDuration != null) {
      expiryTime=expiryDuration.getAdjustedTime(now);
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return updateRecordWithExpiry(key,value,record,expiryTime,now,disableWriteThrough,completionId,source,origin);
}

Fixed version (ground truth):
protected boolean updateRecordWithExpiry(Data key,Object value,R record,ExpiryPolicy expiryPolicy,long now,boolean disableWriteThrough,int completionId,String source,String origin){
  expiryPolicy=getExpiryPolicy(expiryPolicy);
  long expiryTime=CacheRecord.TIME_NOT_AVAILABLE;
  try {
    Duration expiryDuration=expiryPolicy.getExpiryForUpdate();
    if (expiryDuration != null) {
      expiryTime=getAdjustedExpireTime(expiryDuration,now);
    }
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return updateRecordWithExpiry(key,value,record,expiryTime,now,disableWriteThrough,completionId,source,origin);
}
Program: 46518
Project: 46518
Buggy source:
protected R processExpiredEntry(Data key,R record,long expiryTime,long now,String source,String origin){
  boolean isExpired=isExpiredAt(expiryTime,now);
  if (!isExpired) {
    return record;
  }
  if (isStatisticsEnabled()) {
    statistics.increaseCacheExpiries(1);
  }
  R removedRecord=doRemoveRecord(key,source);
  Data keyEventData=toEventData(key);
  Data recordEventData=toEventData(removedRecord);
  onProcessExpiredEntry(key,removedRecord,expiryTime,now,source,origin);
  if (isEventsEnabled()) {
    publishEvent(createCacheExpiredEvent(keyEventData,recordEventData,CacheRecord.TIME_NOT_AVAILABLE,origin,IGNORE_COMPLETION));
  }
  return null;
}

Fixed version (ground truth):
protected R processExpiredEntry(Data key,R record,long expiryTime,long now,String source,String origin){
  if (!isExpiredAt(expiryTime,now)) {
    return record;
  }
  if (isStatisticsEnabled()) {
    statistics.increaseCacheExpiries(1);
  }
  R removedRecord=doRemoveRecord(key,source);
  Data keyEventData=toEventData(key);
  Data recordEventData=toEventData(removedRecord);
  onProcessExpiredEntry(key,removedRecord,expiryTime,now,source,origin);
  if (isEventsEnabled()) {
    publishEvent(createCacheExpiredEvent(keyEventData,recordEventData,CacheRecord.TIME_NOT_AVAILABLE,origin,IGNORE_COMPLETION));
  }
  return null;
}
Program: 46519
Project: 46519
Buggy source:
/** 
 * Extracts and validates the quantifier from the given path token
 * @param token    token from which the quantifier is retrieved
 * @param fullPath fullPath to which the token belongs - just for output
 * @return validated quantifier
 */
static int validateAndGetArrayQuantifierFromCurrentToken(String token,String fullPath){
  String quantifier=extractArgumentsFromAttributeName(token);
  if (quantifier == null) {
    throw new IllegalArgumentException("String_Node_Str" + quantifier + "String_Node_Str"+ fullPath);
  }
  int index=Integer.valueOf(quantifier);
  if (index < 0) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str"+ fullPath);
  }
  return index;
}

Fixed version (ground truth):
/** 
 * Extracts and validates the quantifier from the given path token
 * @param token    token from which the quantifier is retrieved
 * @param fullPath fullPath to which the token belongs - just for output
 * @return validated quantifier
 */
static int validateAndGetArrayQuantifierFromCurrentToken(String token,String fullPath){
  String quantifier=extractArgumentsFromAttributeName(token);
  if (quantifier == null) {
    throw new IllegalArgumentException("String_Node_Str" + fullPath);
  }
  int index=Integer.parseInt(quantifier);
  if (index < 0) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str"+ fullPath);
  }
  return index;
}
Program: 46520
Project: 46520
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  Object output=f.apply(input);
  shouldBackup=true;
  backup=nodeEngine.toData(output);
  atomicReferenceContainer.set(backup);
  response=output;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Data originalData=atomicReferenceContainer.get();
  Object input=nodeEngine.toObject(originalData);
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(originalData,serializedOutput);
  if (shouldBackup) {
    backup=serializedOutput;
    atomicReferenceContainer.set(backup);
  }
  response=output;
}
Program: 46521
Project: 46521
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer reference=getReferenceContainer();
  Object input=nodeEngine.toObject(reference.get());
  Object output=f.apply(input);
  shouldBackup=!isEquals(input,output);
  if (shouldBackup) {
    backup=nodeEngine.toData(output);
    reference.set(backup);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer reference=getReferenceContainer();
  Data originalData=reference.get();
  Object input=nodeEngine.toObject(originalData);
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(originalData,serializedOutput);
  if (shouldBackup) {
    backup=serializedOutput;
    reference.set(backup);
  }
}
Program: 46522
Project: 46522
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  response=input;
  Object output=f.apply(input);
  shouldBackup=!isEquals(input,output);
  if (shouldBackup) {
    backup=nodeEngine.toData(output);
    atomicReferenceContainer.set(backup);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  response=atomicReferenceContainer.get();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(response,serializedOutput);
  if (shouldBackup) {
    atomicReferenceContainer.set(serializedOutput);
    backup=serializedOutput;
  }
}
Program: 46523
Project: 46523
Buggy source:
@Test public void getAndAlter_when_same_reference(){
  BitSet bitSet=new BitSet();
  IAtomicReference<BitSet> ref2=newInstance();
  ref2.set(bitSet);
  bitSet.set(100);
  assertEquals(bitSet,ref2.alterAndGet(new FailingFunctionAlter()));
  assertEquals(bitSet,ref2.get());
}

Fixed version (ground truth):
@Test public void getAndAlter_when_same_reference(){
  BitSet bitSet=new BitSet();
  IAtomicReference<BitSet> ref2=newInstance();
  ref2.set(bitSet);
  assertEquals(bitSet,ref2.getAndAlter(new FailingFunctionAlter()));
  bitSet.set(100);
  assertEquals(bitSet,ref2.get());
}
Program: 46524
Project: 46524
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  Object output=f.apply(input);
  shouldBackup=true;
  backup=nodeEngine.toData(output);
  atomicReferenceContainer.set(backup);
  response=output;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Data originalData=atomicReferenceContainer.get();
  Object input=nodeEngine.toObject(originalData);
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(originalData,serializedOutput);
  if (shouldBackup) {
    backup=serializedOutput;
    atomicReferenceContainer.set(backup);
  }
  response=output;
}
Program: 46525
Project: 46525
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer reference=getReferenceContainer();
  Object input=nodeEngine.toObject(reference.get());
  Object output=f.apply(input);
  shouldBackup=!isEquals(input,output);
  if (shouldBackup) {
    backup=nodeEngine.toData(output);
    reference.set(backup);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer reference=getReferenceContainer();
  Data originalData=reference.get();
  Object input=nodeEngine.toObject(originalData);
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(originalData,serializedOutput);
  if (shouldBackup) {
    backup=serializedOutput;
    reference.set(backup);
  }
}
Program: 46526
Project: 46526
Buggy source:
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  response=input;
  Object output=f.apply(input);
  shouldBackup=!isEquals(input,output);
  if (shouldBackup) {
    backup=nodeEngine.toData(output);
    atomicReferenceContainer.set(backup);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  NodeEngine nodeEngine=getNodeEngine();
  IFunction f=nodeEngine.toObject(function);
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  response=atomicReferenceContainer.get();
  Object input=nodeEngine.toObject(atomicReferenceContainer.get());
  Object output=f.apply(input);
  Data serializedOutput=nodeEngine.toData(output);
  shouldBackup=!isEquals(response,serializedOutput);
  if (shouldBackup) {
    atomicReferenceContainer.set(serializedOutput);
    backup=serializedOutput;
  }
}
Program: 46527
Project: 46527
Buggy source:
@Test public void getAndAlter_when_same_reference(){
  BitSet bitSet=new BitSet();
  IAtomicReference<BitSet> ref2=newInstance();
  ref2.set(bitSet);
  bitSet.set(100);
  assertEquals(bitSet,ref2.alterAndGet(new FailingFunctionAlter()));
  assertEquals(bitSet,ref2.get());
}

Fixed version (ground truth):
@Test public void getAndAlter_when_same_reference(){
  BitSet bitSet=new BitSet();
  IAtomicReference<BitSet> ref2=newInstance();
  ref2.set(bitSet);
  assertEquals(bitSet,ref2.getAndAlter(new FailingFunctionAlter()));
  bitSet.set(100);
  assertEquals(bitSet,ref2.get());
}
Program: 46528
Project: 46528
Buggy source:
public AWSClient(AwsConfig awsConfig){
  if (awsConfig == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getAccessKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getSecretKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.awsConfig=awsConfig;
  endpoint=awsConfig.getHostHeader();
  if (awsConfig.getRegion() != null && awsConfig.getRegion().length() > 0) {
    setEndpoint("String_Node_Str" + awsConfig.getRegion() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public AWSClient(AwsConfig awsConfig){
  if (awsConfig == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getAccessKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getSecretKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.awsConfig=awsConfig;
  endpoint=awsConfig.getHostHeader();
  if (awsConfig.getRegion() != null && awsConfig.getRegion().length() > 0) {
    if (!awsConfig.getHostHeader().startsWith("String_Node_Str")) {
      throw new InvalidConfigurationException("String_Node_Str");
    }
    setEndpoint(awsConfig.getHostHeader().replace("String_Node_Str","String_Node_Str" + awsConfig.getRegion() + "String_Node_Str"));
  }
}
Program: 46529
Project: 46529
Buggy source:
private void tryGetDefaultIamRole(){
  if (!awsConfig.getIamRole().equals("String_Node_Str")) {
    return;
  }
  try {
    String query="String_Node_Str";
    URL url;
    url=new URL("String_Node_Str",IAM_ROLE_ENDPOINT,query);
    InputStreamReader is=new InputStreamReader(url.openStream(),"String_Node_Str");
    BufferedReader reader=new BufferedReader(is);
    awsConfig.setIamRole(reader.readLine());
  }
 catch (  Exception e) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void tryGetDefaultIamRole() throws IOException {
  InputStreamReader is=null;
  BufferedReader reader=null;
  if (!awsConfig.getIamRole().equals("String_Node_Str")) {
    return;
  }
  try {
    String query="String_Node_Str";
    URL url;
    url=new URL("String_Node_Str",IAM_ROLE_ENDPOINT,query);
    is=new InputStreamReader(url.openStream(),"String_Node_Str");
    reader=new BufferedReader(is);
    awsConfig.setIamRole(reader.readLine());
  }
 catch (  IOException e) {
    throw new InvalidConfigurationException("String_Node_Str");
  }
 finally {
    if (is != null) {
      is.close();
    }
    if (reader != null) {
      reader.close();
    }
  }
}
Program: 46530
Project: 46530
Buggy source:
public DescribeInstances(AwsConfig awsConfig,String endpoint){
  if (awsConfig == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getAccessKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.awsConfig=awsConfig;
  this.endpoint=endpoint;
  if (awsConfig.getIamRole() != null) {
    tryGetDefaultIamRole();
    getKeysFromIamRole();
  }
  rs=new EC2RequestSigner(awsConfig,timeStamp,endpoint);
  attributes.put("String_Node_Str",this.getClass().getSimpleName());
  attributes.put("String_Node_Str",DOC_VERSION);
  attributes.put("String_Node_Str",SIGNATURE_METHOD_V4);
  attributes.put("String_Node_Str",rs.createFormattedCredential());
  attributes.put("String_Node_Str",timeStamp);
  attributes.put("String_Node_Str","String_Node_Str");
  attributes.put("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public DescribeInstances(AwsConfig awsConfig,String endpoint) throws IOException {
  if (awsConfig == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (awsConfig.getAccessKey() == null && awsConfig.getIamRole() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.awsConfig=awsConfig;
  this.endpoint=endpoint;
  if (awsConfig.getIamRole() != null) {
    tryGetDefaultIamRole();
    getKeysFromIamRole();
  }
  rs=new EC2RequestSigner(awsConfig,timeStamp,endpoint);
  attributes.put("String_Node_Str",this.getClass().getSimpleName());
  attributes.put("String_Node_Str",DOC_VERSION);
  attributes.put("String_Node_Str",SIGNATURE_METHOD_V4);
  attributes.put("String_Node_Str",rs.createFormattedCredential());
  attributes.put("String_Node_Str",timeStamp);
  attributes.put("String_Node_Str","String_Node_Str");
  attributes.put("String_Node_Str","String_Node_Str");
}
Program: 46531
Project: 46531
Buggy source:
@Test public void test_whenProperConfig(){
  AwsConfig awsConfig=new AwsConfig();
  awsConfig.setAccessKey("String_Node_Str");
  awsConfig.setSecretKey("String_Node_Str");
  new DescribeInstances(awsConfig,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void test_whenProperConfig() throws IOException {
  AwsConfig awsConfig=new AwsConfig();
  awsConfig.setAccessKey("String_Node_Str");
  awsConfig.setSecretKey("String_Node_Str");
  new DescribeInstances(awsConfig,"String_Node_Str");
}
Program: 46532
Project: 46532
Buggy source:
@Test(expected=IllegalArgumentException.class) public void test_whenAwsConfigIsNull(){
  new DescribeInstances(null,"String_Node_Str");
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void test_whenAwsConfigIsNull() throws IOException {
  new DescribeInstances(null,"String_Node_Str");
}
Program: 46533
Project: 46533
Buggy source:
@Test(expected=IllegalArgumentException.class) public void test_whenAccessKeyNull(){
  new DescribeInstances(new AwsConfig(),"String_Node_Str");
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void test_whenAccessKeyNull() throws IOException {
  new DescribeInstances(new AwsConfig(),"String_Node_Str");
}
Program: 46534
Project: 46534
Buggy source:
@Test public void testSigning() throws NoSuchFieldException, IllegalAccessException {
  AwsConfig awsConfig=new AwsConfig();
  awsConfig.setRegion(TEST_REGION).setHostHeader(TEST_HOST).setAccessKey(TEST_ACCESS_KEY).setSecretKey(TEST_SECRET_KEY);
  DescribeInstances di=new DescribeInstances(awsConfig,TEST_HOST);
  Field attributesField=di.getClass().getDeclaredField("String_Node_Str");
  attributesField.setAccessible(true);
  Map<String,String> attributes=(Map<String,String>)attributesField.get(di);
  attributes.put("String_Node_Str",TEST_REQUEST_DATE);
  EC2RequestSigner rs=new EC2RequestSigner(awsConfig,TEST_REQUEST_DATE,TEST_HOST);
  attributes.put("String_Node_Str",rs.createFormattedCredential());
  String signature=rs.sign(TEST_SERVICE,attributes);
  assertEquals(TEST_SIGNATURE_EXPECTED,signature);
}

Fixed version (ground truth):
@Test public void testSigning() throws NoSuchFieldException, IllegalAccessException, IOException {
  AwsConfig awsConfig=new AwsConfig();
  awsConfig.setRegion(TEST_REGION).setHostHeader(TEST_HOST).setAccessKey(TEST_ACCESS_KEY).setSecretKey(TEST_SECRET_KEY);
  DescribeInstances di=new DescribeInstances(awsConfig,TEST_HOST);
  Field attributesField=di.getClass().getDeclaredField("String_Node_Str");
  attributesField.setAccessible(true);
  Map<String,String> attributes=(Map<String,String>)attributesField.get(di);
  attributes.put("String_Node_Str",TEST_REQUEST_DATE);
  EC2RequestSigner rs=new EC2RequestSigner(awsConfig,TEST_REQUEST_DATE,TEST_HOST);
  attributes.put("String_Node_Str",rs.createFormattedCredential());
  String signature=rs.sign(TEST_SERVICE,attributes);
  assertEquals(TEST_SIGNATURE_EXPECTED,signature);
}
Program: 46535
Project: 46535
Buggy source:
/** 
 * Creates a server instance of Hazelcast If user pass print.port property, Server writes port number of the instance to file. The file name is the same as print.port property.
 * @param args none
 */
public static void main(String[] args) throws FileNotFoundException {
  HazelcastInstance hz=Hazelcast.newHazelcastInstance(null);
  printMemberPort(hz);
}

Fixed version (ground truth):
/** 
 * Creates a server instance of Hazelcast If user pass print.port property, Server writes port number of the instance to file. The file name is the same as print.port property.
 * @param args none
 */
public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
  HazelcastInstance hz=Hazelcast.newHazelcastInstance(null);
  printMemberPort(hz);
}
Program: 46536
Project: 46536
Buggy source:
public static void printMemberPort(HazelcastInstance hz) throws FileNotFoundException {
  if (System.getProperty("String_Node_Str") != null) {
    PrintWriter printWriter=null;
    try {
      printWriter=new PrintWriter("String_Node_Str" + File.pathSeparator + System.getProperty("String_Node_Str"));
      printWriter.println(hz.getCluster().getLocalMember().getAddress().getPort());
    }
 catch (    FileNotFoundException e) {
      throw e;
    }
 finally {
      if (printWriter != null) {
        printWriter.close();
      }
    }
  }
}

Fixed version (ground truth):
public static void printMemberPort(HazelcastInstance hz) throws FileNotFoundException, UnsupportedEncodingException {
  if (System.getProperty("String_Node_Str") != null) {
    PrintWriter printWriter=null;
    try {
      printWriter=new PrintWriter("String_Node_Str" + File.pathSeparator + System.getProperty("String_Node_Str"),"String_Node_Str");
      printWriter.println(hz.getCluster().getLocalMember().getAddress().getPort());
    }
 catch (    FileNotFoundException e) {
      throw e;
    }
 finally {
      if (printWriter != null) {
        printWriter.close();
      }
    }
  }
}
Program: 46537
Project: 46537
Buggy source:
@Test public void testMain() throws FileNotFoundException {
  StartServer.main(new String[]{});
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}

Fixed version (ground truth):
@Test public void testMain() throws FileNotFoundException, UnsupportedEncodingException {
  StartServer.main(new String[]{});
  assertEquals(1,Hazelcast.getAllHazelcastInstances().size());
}
Program: 46538
Project: 46538
Buggy source:
@Override public int hashCode(){
  return super.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=super.hashCode();
  result=31 * result + partitionId;
  result=31 * result + (member != null ? member.hashCode() : 0);
  return result;
}
Program: 46539
Project: 46539
Buggy source:
@Override public boolean equals(Object o){
  return super.equals(o);
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof CachePartitionEventData)) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  CachePartitionEventData that=(CachePartitionEventData)o;
  if (partitionId != that.partitionId) {
    return false;
  }
  if (member != null ? !member.equals(that.member) : that.member != null) {
    return false;
  }
  return true;
}
Program: 46540
Project: 46540
Buggy source:
@Override public int hashCode(){
  return super.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=super.hashCode();
  result=31 * result + partitionId;
  result=31 * result + (member != null ? member.hashCode() : 0);
  return result;
}
Program: 46541
Project: 46541
Buggy source:
@Override public boolean equals(Object o){
  return super.equals(o);
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof CachePartitionEventData)) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  CachePartitionEventData that=(CachePartitionEventData)o;
  if (partitionId != that.partitionId) {
    return false;
  }
  if (member != null ? !member.equals(that.member) : that.member != null) {
    return false;
  }
  return true;
}
Program: 46542
Project: 46542
Buggy source:
@Override public void run() throws Exception {
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  returnValue=atomicReferenceContainer.compareAndSet(expect,update);
  shouldBackup=!returnValue;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  returnValue=atomicReferenceContainer.compareAndSet(expect,update);
  shouldBackup=returnValue;
}
Program: 46543
Project: 46543
Buggy source:
@Override public void run() throws Exception {
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  returnValue=atomicReferenceContainer.compareAndSet(expect,update);
  shouldBackup=!returnValue;
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  AtomicReferenceContainer atomicReferenceContainer=getReferenceContainer();
  returnValue=atomicReferenceContainer.compareAndSet(expect,update);
  shouldBackup=returnValue;
}
Program: 46544
Project: 46544
Buggy source:
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=url.toURI();
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}

Fixed version (ground truth):
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=new URI(url.toExternalForm().replace("String_Node_Str","String_Node_Str"));
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}
Program: 46545
Project: 46545
Buggy source:
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=url.toURI();
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}

Fixed version (ground truth):
private static Set<URLDefinition> collectFactoryUrls(String factoryId,ClassLoader classLoader){
  final String resourceName="String_Node_Str" + factoryId;
  try {
    final Enumeration<URL> configs;
    if (classLoader != null) {
      configs=classLoader.getResources(resourceName);
    }
 else {
      configs=ClassLoader.getSystemResources(resourceName);
    }
    Set<URLDefinition> urlDefinitions=new HashSet<URLDefinition>();
    while (configs.hasMoreElements()) {
      URL url=configs.nextElement();
      final URI uri=new URI(url.toExternalForm().replace("String_Node_Str","String_Node_Str"));
      ClassLoader highestClassLoader=findHighestReachableClassLoader(url,classLoader,resourceName);
      if (!highestClassLoader.getClass().getName().equals(IGNORED_GLASSFISH_MAGIC_CLASSLOADER)) {
        urlDefinitions.add(new URLDefinition(uri,highestClassLoader));
      }
    }
    return urlDefinitions;
  }
 catch (  Exception e) {
    LOGGER.severe(e);
  }
  return Collections.emptySet();
}
Program: 46546
Project: 46546
Buggy source:
Connection get(int timeout) throws Throwable {
  countDownLatch.await(timeout,TimeUnit.MILLISECONDS);
  if (connection != null) {
    return connection;
  }
  if (throwable != null) {
    throw throwable;
  }
  throw new TimeoutException("String_Node_Str" + timeout + "String_Node_Str");
}

Fixed version (ground truth):
Connection get(int timeout) throws Throwable {
  if (!countDownLatch.await(timeout,TimeUnit.MILLISECONDS)) {
    throw new TimeoutException("String_Node_Str" + timeout + "String_Node_Str");
  }
  if (connection != null) {
    return connection;
  }
  throw throwable;
}