nus-yam/ex-repair huggingface dataset:
Program: 48983
Project: 48983
Buggy source:
private TxBackupLog(List<TransactionLog> txLogs,String callerUuid,String txnId,long timeoutMillis,long startTime){
  this.txLogs=txLogs;
  this.callerUuid=callerUuid;
  this.txnId=txnId;
  this.timeoutMillis=timeoutMillis;
  this.startTime=startTime;
}

Fixed version (ground truth):
private TxBackupLog(List<TransactionLog> txLogs,String callerUuid,State state,long timeoutMillis,long startTime){
  this.txLogs=txLogs;
  this.callerUuid=callerUuid;
  this.state=state;
  this.timeoutMillis=timeoutMillis;
  this.startTime=startTime;
}
Program: 48984
Project: 48984
Buggy source:
protected final int getPartition(){
  return clientEngine.getPartitionService().getPartitionId(getKey());
}

Fixed version (ground truth):
protected final int getPartition(){
  final Object key=getKey();
  if (key instanceof String) {
    return clientEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey((String)key));
  }
  return clientEngine.getPartitionService().getPartitionId(key);
}
Program: 48985
Project: 48985
Buggy source:
public void removeNumber(int partitionId){
  final Iterator<String> iterator=numbers.keySet().iterator();
  while (iterator.hasNext()) {
    String name=iterator.next();
    if (nodeEngine.getPartitionService().getPartitionId(name) == partitionId) {
      iterator.remove();
    }
  }
}

Fixed version (ground truth):
public void removeNumber(int partitionId){
  final Iterator<String> iterator=numbers.keySet().iterator();
  while (iterator.hasNext()) {
    String name=iterator.next();
    if (nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name)) == partitionId) {
      iterator.remove();
    }
  }
}
Program: 48986
Project: 48986
Buggy source:
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Long> data=new HashMap<String,Long>();
  final int partitionId=event.getPartitionId();
  for (  String name : numbers.keySet()) {
    if (partitionId == nodeEngine.getPartitionService().getPartitionId(name)) {
      data.put(name,numbers.get(name).get());
    }
  }
  return data.isEmpty() ? null : new AtomicLongReplicationOperation(data);
}

Fixed version (ground truth):
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  Map<String,Long> data=new HashMap<String,Long>();
  final int partitionId=event.getPartitionId();
  for (  String name : numbers.keySet()) {
    if (partitionId == nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name))) {
      data.put(name,numbers.get(name).get());
    }
  }
  return data.isEmpty() ? null : new AtomicLongReplicationOperation(data);
}
Program: 48987
Project: 48987
Buggy source:
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  final Collection<CountDownLatchInfo> data=new LinkedList<CountDownLatchInfo>();
  for (  Map.Entry<String,CountDownLatchInfo> latchEntry : latches.entrySet()) {
    if (nodeEngine.getPartitionService().getPartitionId(latchEntry.getKey()) == event.getPartitionId()) {
      data.add(latchEntry.getValue());
    }
  }
  return data.isEmpty() ? null : new CountDownLatchReplicationOperation(data);
}

Fixed version (ground truth):
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  if (event.getReplicaIndex() > 1) {
    return null;
  }
  final Collection<CountDownLatchInfo> data=new LinkedList<CountDownLatchInfo>();
  for (  Map.Entry<String,CountDownLatchInfo> latchEntry : latches.entrySet()) {
    final String name=latchEntry.getKey();
    if (nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name)) == event.getPartitionId()) {
      data.add(latchEntry.getValue());
    }
  }
  return data.isEmpty() ? null : new CountDownLatchReplicationOperation(data);
}
Program: 48988
Project: 48988
Buggy source:
private void clearPartition(int partitionId){
  final Iterator<String> iter=latches.keySet().iterator();
  while (iter.hasNext()) {
    if (nodeEngine.getPartitionService().getPartitionId(iter.next()) == partitionId) {
      iter.remove();
    }
  }
}

Fixed version (ground truth):
private void clearPartition(int partitionId){
  final Iterator<String> iter=latches.keySet().iterator();
  while (iter.hasNext()) {
    final String name=iter.next();
    if (nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name)) == partitionId) {
      iter.remove();
    }
  }
}
Program: 48989
Project: 48989
Buggy source:
public Permit createNew(String name){
  SemaphoreConfig config=nodeEngine.getConfig().getSemaphoreConfig(name);
  int partitionId=nodeEngine.getPartitionService().getPartitionId(name);
  return new Permit(partitionId,new SemaphoreConfig(config));
}

Fixed version (ground truth):
public Permit createNew(String name){
  SemaphoreConfig config=nodeEngine.getConfig().getSemaphoreConfig(name);
  int partitionId=nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
  return new Permit(partitionId,new SemaphoreConfig(config));
}
Program: 48990
Project: 48990
Buggy source:
private void onOwnerDisconnected(final String caller){
  for (  String name : permitMap.keySet()) {
    int partitionId=nodeEngine.getPartitionService().getPartitionId(name);
    PartitionView info=nodeEngine.getPartitionService().getPartition(partitionId);
    if (nodeEngine.getThisAddress().equals(info.getOwner())) {
      Operation op=new SemaphoreDeadMemberOperation(name,caller).setPartitionId(partitionId).setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler()).setService(this).setNodeEngine(nodeEngine).setServiceName(SERVICE_NAME);
      nodeEngine.getOperationService().executeOperation(op);
    }
  }
}

Fixed version (ground truth):
private void onOwnerDisconnected(final String caller){
  for (  String name : permitMap.keySet()) {
    int partitionId=nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
    PartitionView info=nodeEngine.getPartitionService().getPartition(partitionId);
    if (nodeEngine.getThisAddress().equals(info.getOwner())) {
      Operation op=new SemaphoreDeadMemberOperation(name,caller).setPartitionId(partitionId).setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler()).setService(this).setNodeEngine(nodeEngine).setServiceName(SERVICE_NAME);
      nodeEngine.getOperationService().executeOperation(op);
    }
  }
}
Program: 48991
Project: 48991
Buggy source:
public QueueContainer(String name,int partitionId,QueueConfig config,NodeEngine nodeEngine,QueueService service) throws Exception {
  this(name);
  this.partitionId=partitionId;
  setConfig(config,nodeEngine,service);
}

Fixed version (ground truth):
public QueueContainer(String name,QueueConfig config,NodeEngine nodeEngine,QueueService service) throws Exception {
  this(name);
  setConfig(config,nodeEngine,service);
}
Program: 48992
Project: 48992
Buggy source:
public long txnOfferReserve(){
  QueueItem item=new QueueItem(this,nextId(),null);
  txMap.put(item.getItemId(),item);
  return item.getItemId();
}

Fixed version (ground truth):
public long txnOfferReserve(String transactionId){
  TxQueueItem item=new TxQueueItem(this,nextId(),null).setTransactionId(transactionId).setPollOperation(false);
  txMap.put(item.getItemId(),item);
  return item.getItemId();
}
Program: 48993
Project: 48993
Buggy source:
public void writeData(ObjectDataOutput out) throws IOException {
  out.writeInt(partitionId);
  out.writeInt(getItemQueue().size());
  for (  QueueItem item : getItemQueue()) {
    item.writeData(out);
  }
  out.writeInt(txMap.size());
  for (  QueueItem item : txMap.values()) {
    item.writeData(out);
  }
}

Fixed version (ground truth):
public void writeData(ObjectDataOutput out) throws IOException {
  out.writeInt(getItemQueue().size());
  for (  QueueItem item : getItemQueue()) {
    item.writeData(out);
  }
  out.writeInt(txMap.size());
  for (  QueueItem item : txMap.values()) {
    item.writeData(out);
  }
}
Program: 48994
Project: 48994
Buggy source:
public void readData(ObjectDataInput in) throws IOException {
  partitionId=in.readInt();
  int size=in.readInt();
  for (int j=0; j < size; j++) {
    QueueItem item=new QueueItem(this,-1,null);
    item.readData(in);
    getItemQueue().offer(item);
    setId(item.getItemId());
  }
  int txSize=in.readInt();
  for (int j=0; j < txSize; j++) {
    QueueItem item=new QueueItem(this,-1,null);
    item.readData(in);
    txMap.put(item.getItemId(),item);
    setId(item.getItemId());
  }
}

Fixed version (ground truth):
public void readData(ObjectDataInput in) throws IOException {
  int size=in.readInt();
  for (int j=0; j < size; j++) {
    QueueItem item=new QueueItem(this,-1,null);
    item.readData(in);
    getItemQueue().offer(item);
    setId(item.getItemId());
  }
  int txSize=in.readInt();
  for (int j=0; j < txSize; j++) {
    QueueItem item=new QueueItem(this,-1,null);
    item.readData(in);
    txMap.put(item.getItemId(),item);
    setId(item.getItemId());
  }
}
Program: 48995
Project: 48995
Buggy source:
public QueueItem txnPollReserve(long reservedOfferId){
  QueueItem item=getItemQueue().poll();
  if (item == null) {
    item=txMap.remove(reservedOfferId);
    return item;
  }
  if (store.isEnabled() && item.getData() == null) {
    try {
      load(item);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  txMap.put(item.getItemId(),item);
  return new QueueItem(null,item.getItemId(),item.getData());
}

Fixed version (ground truth):
public QueueItem txnPollReserve(long reservedOfferId,String transactionId){
  QueueItem item=getItemQueue().poll();
  if (item == null) {
    item=txMap.remove(reservedOfferId);
    return item;
  }
  if (store.isEnabled() && item.getData() == null) {
    try {
      load(item);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  txMap.put(item.getItemId(),new TxQueueItem(item).setPollOperation(true).setTransactionId(transactionId));
  return item;
}
Program: 48997
Project: 48997
Buggy source:
public IdentifiedDataSerializable createNew(Integer arg){
  return new CheckAndEvictOperation();
}

Fixed version (ground truth):
public IdentifiedDataSerializable createNew(Integer arg){
  return new QueueTransactionRollbackOperation();
}
Program: 48998
Project: 48998
Buggy source:
public final boolean returnsResponse(){
  return true;
}

Fixed version (ground truth):
public boolean returnsResponse(){
  return true;
}
Program: 48999
Project: 48999
Buggy source:
@Override public void rollbackTransaction(String transactionId){
}

Fixed version (ground truth):
public void rollbackTransaction(String transactionId){
  final Set<String> queueNames=containerMap.keySet();
  for (  String name : queueNames) {
    int partitionId=nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
    Operation operation=new QueueTransactionRollbackOperation(name,transactionId).setPartitionId(partitionId).setService(this).setNodeEngine(nodeEngine);
    nodeEngine.getOperationService().executeOperation(operation);
  }
}
Program: 49000
Project: 49000
Buggy source:
private void clearMigrationData(int partitionId){
  Iterator<Entry<String,QueueContainer>> iterator=containerMap.entrySet().iterator();
  while (iterator.hasNext()) {
    QueueContainer container=iterator.next().getValue();
    if (container.getPartitionId() == partitionId) {
      container.destroy();
      iterator.remove();
    }
  }
}

Fixed version (ground truth):
private void clearMigrationData(int partitionId){
  Iterator<Entry<String,QueueContainer>> iterator=containerMap.entrySet().iterator();
  while (iterator.hasNext()) {
    final Entry<String,QueueContainer> entry=iterator.next();
    final String name=entry.getKey();
    final QueueContainer container=entry.getValue();
    int containerPartitionId=nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
    if (containerPartitionId == partitionId) {
      container.destroy();
      iterator.remove();
    }
  }
}
Program: 49001
Project: 49001
Buggy source:
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  Map<String,QueueContainer> migrationData=new HashMap<String,QueueContainer>();
  for (  Entry<String,QueueContainer> entry : containerMap.entrySet()) {
    String name=entry.getKey();
    QueueContainer container=entry.getValue();
    if (container.getPartitionId() == event.getPartitionId() && container.getConfig().getTotalBackupCount() >= event.getReplicaIndex()) {
      migrationData.put(name,container);
    }
  }
  return migrationData.isEmpty() ? null : new QueueReplicationOperation(migrationData,event.getPartitionId(),event.getReplicaIndex());
}

Fixed version (ground truth):
public Operation prepareReplicationOperation(PartitionReplicationEvent event){
  Map<String,QueueContainer> migrationData=new HashMap<String,QueueContainer>();
  for (  Entry<String,QueueContainer> entry : containerMap.entrySet()) {
    String name=entry.getKey();
    int partitionId=nodeEngine.getPartitionService().getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
    QueueContainer container=entry.getValue();
    if (partitionId == event.getPartitionId() && container.getConfig().getTotalBackupCount() >= event.getReplicaIndex()) {
      migrationData.put(name,container);
    }
  }
  return migrationData.isEmpty() ? null : new QueueReplicationOperation(migrationData,event.getPartitionId(),event.getReplicaIndex());
}
Program: 49002
Project: 49002
Buggy source:
public QueueContainer getOrCreateContainer(final String name,boolean fromBackup) throws Exception {
  QueueContainer container=containerMap.get(name);
  if (container == null) {
    container=new QueueContainer(name,nodeEngine.getPartitionService().getPartitionId(nodeEngine.toData(name)),nodeEngine.getConfig().getQueueConfig(name),nodeEngine,this);
    QueueContainer existing=containerMap.putIfAbsent(name,container);
    if (existing != null) {
      container=existing;
    }
 else {
      container.init(fromBackup);
    }
  }
  container.cancelEvictionIfExists();
  return container;
}

Fixed version (ground truth):
public QueueContainer getOrCreateContainer(final String name,boolean fromBackup) throws Exception {
  QueueContainer container=containerMap.get(name);
  if (container == null) {
    container=new QueueContainer(name,nodeEngine.getConfig().getQueueConfig(name),nodeEngine,this);
    QueueContainer existing=containerMap.putIfAbsent(name,container);
    if (existing != null) {
      container=existing;
    }
 else {
      container.init(fromBackup);
    }
  }
  container.cancelEvictionIfExists();
  return container;
}
Program: 49003
Project: 49003
Buggy source:
public Object getKey(){
  return itemId;
}

Fixed version (ground truth):
public Object getKey(){
  return new TransactionLogKey(itemId,name);
}
Program: 49004
Project: 49004
Buggy source:
public Object getKey(){
  return itemId;
}

Fixed version (ground truth):
public Object getKey(){
  return new TransactionLogKey(itemId,name);
}
Program: 49005
Project: 49005
Buggy source:
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}

Fixed version (ground truth):
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    if (!active) {
      throw new HazelcastInstanceNotActiveException();
    }
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}
Program: 49006
Project: 49006
Buggy source:
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
}

Fixed version (ground truth):
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
  active=true;
}
Program: 49007
Project: 49007
Buggy source:
public void stop(){
  clusterThread.shutdown();
}

Fixed version (ground truth):
public void stop(){
  active=false;
  clusterThread.shutdown();
}
Program: 49008
Project: 49008
Buggy source:
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (true) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
}

Fixed version (ground truth):
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (active) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
  throw new HazelcastInstanceNotActiveException();
}
Program: 49009
Project: 49009
Buggy source:
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}

Fixed version (ground truth):
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    if (!active) {
      throw new HazelcastInstanceNotActiveException();
    }
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}
Program: 49010
Project: 49010
Buggy source:
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
}

Fixed version (ground truth):
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
  active=true;
}
Program: 49011
Project: 49011
Buggy source:
public void stop(){
  clusterThread.shutdown();
}

Fixed version (ground truth):
public void stop(){
  active=false;
  clusterThread.shutdown();
}
Program: 49012
Project: 49012
Buggy source:
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (true) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
}

Fixed version (ground truth):
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (active) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
  throw new HazelcastInstanceNotActiveException();
}
Program: 49013
Project: 49013
Buggy source:
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}

Fixed version (ground truth):
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    if (active) {
      throw new HazelcastInstanceNotActiveException();
    }
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}
Program: 49014
Project: 49014
Buggy source:
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
}

Fixed version (ground truth):
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
  active=true;
}
Program: 49015
Project: 49015
Buggy source:
public void stop(){
  clusterThread.shutdown();
}

Fixed version (ground truth):
public void stop(){
  active=false;
  clusterThread.shutdown();
}
Program: 49016
Project: 49016
Buggy source:
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (true) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
}

Fixed version (ground truth):
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (active) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
  throw new HazelcastInstanceNotActiveException();
}
Program: 49017
Project: 49017
Buggy source:
@SuppressWarnings("String_Node_Str") public TransactionalObject getTransactionalObject(String serviceName,Object id){
  if (transaction.getState() != Transaction.State.ACTIVE) {
    throw new TransactionNotActiveException("String_Node_Str" + "String_Node_Str" + serviceName + "String_Node_Str"+ id+ "String_Node_Str");
  }
  TransactionalObjectKey key=new TransactionalObjectKey(serviceName,id);
  TransactionalObject obj=txnObjectMap.get(key);
  if (obj == null) {
    final Object service=nodeEngine.getService(serviceName);
    if (service instanceof TransactionalService) {
      obj=((TransactionalService)service).createTransactionalObject(id,transaction);
      txnObjectMap.put(key,obj);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + serviceName + "String_Node_Str");
    }
  }
  return obj;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public TransactionalObject getTransactionalObject(String serviceName,Object id){
  if (transaction.getState() != Transaction.State.ACTIVE) {
    throw new TransactionNotActiveException("String_Node_Str" + "String_Node_Str" + serviceName + "String_Node_Str"+ id+ "String_Node_Str");
  }
  TransactionalObjectKey key=new TransactionalObjectKey(serviceName,id);
  TransactionalObject obj=txnObjectMap.get(key);
  if (obj == null) {
    final Object service=nodeEngine.getService(serviceName);
    if (service instanceof TransactionalService) {
      nodeEngine.getProxyService().initializeDistributedObject(serviceName,id);
      obj=((TransactionalService)service).createTransactionalObject(id,transaction);
      txnObjectMap.put(key,obj);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + serviceName + "String_Node_Str");
    }
  }
  return obj;
}
Program: 49018
Project: 49018
Buggy source:
@SuppressWarnings("String_Node_Str") public TransactionalObject getTransactionalObject(String serviceName,Object id){
  if (transaction.getState() != Transaction.State.ACTIVE) {
    throw new TransactionNotActiveException("String_Node_Str" + "String_Node_Str" + serviceName + "String_Node_Str"+ id+ "String_Node_Str");
  }
  TransactionalObjectKey key=new TransactionalObjectKey(serviceName,id);
  TransactionalObject obj=txnObjectMap.get(key);
  if (obj == null) {
    final Object service=nodeEngine.getService(serviceName);
    if (service instanceof TransactionalService) {
      obj=((TransactionalService)service).createTransactionalObject(id,transaction);
      txnObjectMap.put(key,obj);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + serviceName + "String_Node_Str");
    }
  }
  return obj;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public TransactionalObject getTransactionalObject(String serviceName,Object id){
  if (transaction.getState() != Transaction.State.ACTIVE) {
    throw new TransactionNotActiveException("String_Node_Str" + "String_Node_Str" + serviceName + "String_Node_Str"+ id+ "String_Node_Str");
  }
  TransactionalObjectKey key=new TransactionalObjectKey(serviceName,id);
  TransactionalObject obj=txnObjectMap.get(key);
  if (obj == null) {
    final Object service=nodeEngine.getService(serviceName);
    if (service instanceof TransactionalService) {
      nodeEngine.getProxyService().initializeDistributedObject(serviceName,id);
      obj=((TransactionalService)service).createTransactionalObject(id,transaction);
      txnObjectMap.put(key,obj);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + serviceName + "String_Node_Str");
    }
  }
  return obj;
}
Program: 49019
Project: 49019
Buggy source:
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}

Fixed version (ground truth):
private void _sendAndHandle(ConnectionFactory connectionFactory,Object obj,ResponseHandler handler) throws IOException {
  ResponseStream stream=null;
  while (stream == null) {
    if (active) {
      throw new HazelcastInstanceNotActiveException();
    }
    Connection conn=null;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      stream=new ResponseStreamImpl(serializationService,conn);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
      }
      if (conn != null) {
        IOUtil.closeResource(conn);
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
  }
  try {
    handler.handle(stream);
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e,IOException.class);
  }
 finally {
    stream.end();
  }
}
Program: 49020
Project: 49020
Buggy source:
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
}

Fixed version (ground truth):
public void start(){
  final Future<Connection> f=client.getClientExecutionService().submit(new InitialConnectionCall());
  try {
    final Connection connection=f.get(30,TimeUnit.SECONDS);
    clusterThread.setInitialConn(connection);
  }
 catch (  Throwable e) {
    if (e instanceof ExecutionException && e.getCause() != null) {
      e=e.getCause();
      fixRemoteStackTrace(e,Thread.currentThread().getStackTrace());
    }
    if (e instanceof RuntimeException) {
      throw (RuntimeException)e;
    }
    throw new HazelcastException(e);
  }
  clusterThread.start();
  while (membersRef.get() == null) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new HazelcastException(e);
    }
  }
  active=true;
}
Program: 49021
Project: 49021
Buggy source:
public void stop(){
  clusterThread.shutdown();
}

Fixed version (ground truth):
public void stop(){
  active=false;
  clusterThread.shutdown();
}
Program: 49022
Project: 49022
Buggy source:
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (true) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
}

Fixed version (ground truth):
private <T>T _sendAndReceive(ConnectionFactory connectionFactory,Object obj) throws IOException {
  while (active) {
    Connection conn=null;
    boolean release=true;
    try {
      conn=connectionFactory.create();
      final SerializationService serializationService=getSerializationService();
      final Data request=serializationService.toData(obj);
      conn.write(request);
      final Data response=conn.read();
      final Object result=serializationService.toObject(response);
      return ErrorHandler.returnResultOrThrowException(result);
    }
 catch (    Exception e) {
      if (e instanceof IOException) {
        if (logger.isFinestEnabled()) {
          logger.finest("String_Node_Str" + conn + "String_Node_Str"+ e);
        }
        IOUtil.closeResource(conn);
        release=false;
      }
      if (ErrorHandler.isRetryable(e)) {
        if (redoOperation || obj instanceof RetryableRequest) {
          if (logger.isFinestEnabled()) {
            logger.finest("String_Node_Str" + obj + "String_Node_Str"+ conn+ "String_Node_Str"+ e);
          }
          beforeRetry();
          continue;
        }
      }
      throw ExceptionUtil.rethrow(e,IOException.class);
    }
 finally {
      if (release && conn != null) {
        conn.release();
      }
    }
  }
  throw new HazelcastInstanceNotActiveException();
}
Program: 49023
Project: 49023
Buggy source:
public void run(){
  int partitionId=getPartitionId();
  RecordStore recordStore=mapService.getRecordStore(partitionId,name);
  entrySet=new MapEntrySet();
  for (  Data key : keys) {
    if (partitionId == getNodeEngine().getPartitionService().getPartitionId(key)) {
      Object value=recordStore.get(key);
      if (value != null) {
        entrySet.add(new AbstractMap.SimpleImmutableEntry(key,mapService.toData(value)));
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  int partitionId=getPartitionId();
  RecordStore recordStore=mapService.getRecordStore(partitionId,name);
  Set<Data> partitionKeySet=new HashSet<Data>();
  for (  Data key : keys) {
    if (partitionId == getNodeEngine().getPartitionService().getPartitionId(key)) {
      partitionKeySet.add(key);
    }
  }
  entrySet=recordStore.getAll(partitionKeySet);
}