nus-yam/ex-repair huggingface dataset:
Program: 50476
Project: 50476
Buggy source:
public Object waitAndGetResult(){
  while (true) {
    try {
      Object obj=responses.poll(5,TimeUnit.SECONDS);
      if (obj != null) {
        return obj;
      }
 else       if (node.factory.restarted) {
        reset();
        throw new RuntimeException();
      }
 else       if (!node.active) {
        throw new RuntimeException();
      }
    }
 catch (    InterruptedException e) {
      if (node.factory.restarted) {
        reset();
        throw new RuntimeException();
      }
    }
  }
}

Fixed version (ground truth):
public Object waitAndGetResult(){
  while (true) {
    try {
      Object obj=responses.poll(5,TimeUnit.SECONDS);
      if (obj != null) {
        return obj;
      }
 else       if (node.factory.restarted) {
        reset();
        throw new RuntimeException();
      }
 else       if (!node.active) {
        throw new IllegalStateException("String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
      if (node.factory.restarted) {
        reset();
        throw new RuntimeException();
      }
    }
  }
}
Program: 50477
Project: 50477
Buggy source:
public void stop(){
  queue.clear();
  try {
    final CountDownLatch l=new CountDownLatch(1);
    queue.put(new Processable(){
      public void process(){
        running=false;
        l.countDown();
      }
    }
);
    l.await();
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
public void stop(){
  packetQueue.clear();
  processableQueue.clear();
  try {
    final CountDownLatch l=new CountDownLatch(1);
    processableQueue.put(new Processable(){
      public void process(){
        running=false;
        l.countDown();
      }
    }
);
    l.await();
  }
 catch (  InterruptedException ignored) {
  }
}
Program: 50478
Project: 50478
Buggy source:
public void enqueueAndReturn(final Object message){
  try {
    queue.put(message);
  }
 catch (  final InterruptedException e) {
    node.handleInterruptedException(Thread.currentThread(),e);
  }
}

Fixed version (ground truth):
public void enqueueAndReturn(Processable message){
  try {
    processableQueue.put(message);
    enqueueLock.lock();
    notEmpty.signal();
  }
 catch (  InterruptedException e) {
    node.handleInterruptedException(Thread.currentThread(),e);
  }
 finally {
    enqueueLock.unlock();
  }
}
Program: 50479
Project: 50479
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + queue.size() + "String_Node_Str"+ node.master()+ "String_Node_Str"+ node.getMasterAddress();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + packetQueue.size() + "String_Node_Str"+ processableQueue.size()+ "String_Node_Str"+ node.master()+ "String_Node_Str"+ node.getMasterAddress();
}
Program: 50480
Project: 50480
Buggy source:
void enqueueFullPacket(Packet p){
  p.flipBuffers();
  p.read();
  p.setFromConnection(connection);
  if (p.client) {
    node.clientService.handle(p);
  }
 else {
    clusterService.enqueueAndReturn(p);
  }
}

Fixed version (ground truth):
void enqueueFullPacket(final Packet p){
  p.flipBuffers();
  p.read();
  p.setFromConnection(connection);
  if (p.client) {
    node.clientService.handle(p);
  }
 else {
    clusterService.enqueuePacket(p);
  }
}
Program: 50482
Project: 50482
Buggy source:
public void run(){
  put(entry.getKey(),entry.getValue());
}

Fixed version (ground truth):
public void run(){
  put(entry.getKey(),entry.getValue());
  latch.countDown();
}
Program: 50483
Project: 50483
Buggy source:
public void putAll(Map map){
  Set<Entry> entries=map.entrySet();
  final CountDownLatch latch=new CountDownLatch(entries.size());
  for (  final Entry entry : entries) {
    factory.node.executorManager.executeLocally(new Runnable(){
      public void run(){
        put(entry.getKey(),entry.getValue());
      }
    }
);
    latch.countDown();
  }
  try {
    latch.await();
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
public void putAll(Map map){
  Set<Entry> entries=map.entrySet();
  final CountDownLatch latch=new CountDownLatch(entries.size());
  for (  final Entry entry : entries) {
    factory.node.executorManager.executeLocally(new Runnable(){
      public void run(){
        put(entry.getKey(),entry.getValue());
        latch.countDown();
      }
    }
);
  }
  try {
    latch.await();
  }
 catch (  InterruptedException ignored) {
  }
}
Program: 50484
Project: 50484
Buggy source:
public void readData(DataInput in) throws IOException {
  setName(in.readUTF());
  setFactory(ThreadContext.get().getCurrentFactory());
}

Fixed version (ground truth):
public void readData(DataInput in) throws IOException {
  this.name=in.readUTF();
}
Program: 50485
Project: 50485
Buggy source:
public Long call(){
  FactoryImpl factory=getFactoryImpl(factoryName);
  MProxy map=factory.idGeneratorMapProxy;
  map.lock(name);
  try {
    Long max=(Long)map.get(name);
    if (max == null) {
      max=0L;
      map.put(name,0L);
      return max;
    }
 else {
      Long newMax=max + 1;
      map.put(name,newMax);
      return newMax;
    }
  }
  finally {
    map.unlock(name);
  }
}

Fixed version (ground truth):
public Long call(){
  MProxy map=((FactoryImpl)hazelcastInstance).idGeneratorMapProxy;
  map.lock(name);
  try {
    Long max=(Long)map.get(name);
    if (max == null) {
      max=0L;
      map.put(name,0L);
      return max;
    }
 else {
      Long newMax=max + 1;
      map.put(name,newMax);
      return newMax;
    }
  }
  finally {
    map.unlock(name);
  }
}
Program: 50486
Project: 50486
Buggy source:
private Long getNewMillion(){
  try {
    DistributedTask<Long> task=new DistributedTask<Long>(new IncrementTask(name,factory.getName()));
    factory.executorServiceImpl.execute(task);
    return task.get();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
private Long getNewMillion(){
  try {
    DistributedTask<Long> task=new DistributedTask<Long>(new IncrementTask(name,factory));
    factory.executorServiceImpl.execute(task);
    return task.get();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 50487
Project: 50487
Buggy source:
public IncrementTask(String uuidName,String factoryName){
  super();
  this.name=uuidName;
  this.factoryName=factoryName;
}

Fixed version (ground truth):
public IncrementTask(String uuidName,HazelcastInstance hazelcastInstance){
  super();
  this.name=uuidName;
  this.hazelcastInstance=hazelcastInstance;
}
Program: 50488
Project: 50488
Buggy source:
public long size(){
  return (lsKeyValues == null) ? 0 : lsKeyValues.size();
}

Fixed version (ground truth):
public int size(){
  return (lsKeyValues == null) ? 0 : lsKeyValues.size();
}
Program: 50489
Project: 50489
Buggy source:
public void setName(String factoryName,String name){
  this.factoryName=factoryName;
  this.name=name;
}

Fixed version (ground truth):
public void setName(FactoryImpl factoryImpl,String name){
  this.factory=factoryImpl;
  this.name=name;
}
Program: 50490
Project: 50490
Buggy source:
public Object setValue(Object newValue){
  if (name == null)   throw new UnsupportedOperationException();
  this.objValue=value;
  FactoryImpl factory=FactoryImpl.getFactoryImpl(factoryName);
  return ((FactoryImpl.MProxy)factory.getOrCreateProxyByName(name)).put(getKey(),newValue);
}

Fixed version (ground truth):
public Object setValue(Object newValue){
  if (name == null)   throw new UnsupportedOperationException();
  this.objValue=value;
  return ((FactoryImpl.MProxy)factory.getOrCreateProxyByName(name)).put(key,newValue);
}
Program: 50492
Project: 50492
Buggy source:
@Test public void iterate(){
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  IList list=hClient.getList("String_Node_Str");
  list.add(1);
  list.add(2);
  list.add(2);
  list.add(3);
  assertEquals(4,list.size());
  Map<Integer,Integer> counter=new HashMap<Integer,Integer>();
  counter.put(1,1);
  counter.put(2,2);
  counter.put(3,1);
  for (Iterator<Integer> iterator=list.iterator(); iterator.hasNext(); ) {
    Integer integer=(Integer)iterator.next();
    counter.put(integer,counter.get(integer) - 1);
    iterator.remove();
  }
  assertEquals(0,counter.get(1));
  assertEquals(0,counter.get(2));
  assertEquals(0,counter.get(3));
  assertTrue(list.isEmpty());
}

Fixed version (ground truth):
@Test public void iterate(){
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  IList list=hClient.getList("String_Node_Str");
  list.add(1);
  list.add(2);
  list.add(2);
  list.add(3);
  assertEquals(4,list.size());
  Map counter=new HashMap();
  counter.put(1,1);
  counter.put(2,2);
  counter.put(3,1);
  for (Iterator<Integer> iterator=list.iterator(); iterator.hasNext(); ) {
    Integer integer=(Integer)iterator.next();
    counter.put(integer,(Integer)counter.get(integer) - 1);
    iterator.remove();
  }
  assertEquals(0,counter.get(1));
  assertEquals(0,counter.get(2));
  assertEquals(0,counter.get(3));
  assertTrue(list.isEmpty());
}
Program: 50493
Project: 50493
Buggy source:
@Test public void lockMap() throws InterruptedException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap map=hClient.getMap("String_Node_Str");
  final CountDownLatch latch=new CountDownLatch(1);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(1000);
  System.out.println("String_Node_Str");
  map.lock("String_Node_Str");
  System.out.println("String_Node_Str");
  new Thread(new Runnable(){
    public void run(){
      map.lock("String_Node_Str");
      System.out.println("String_Node_Str");
      latch.countDown();
    }
  }
).start();
  Thread.sleep(100);
  assertEquals(1,latch.getCount());
  System.out.println("String_Node_Str");
  map.unlock("String_Node_Str");
  System.out.println("String_Node_Str");
  assertTrue(latch.await(100000,TimeUnit.MILLISECONDS));
}

Fixed version (ground truth):
@Test public void lockMap() throws InterruptedException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap map=hClient.getMap("String_Node_Str");
  final CountDownLatch latch=new CountDownLatch(1);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(1000);
  System.out.println("String_Node_Str");
  map.lock("String_Node_Str");
  System.out.println("String_Node_Str");
  new Thread(new Runnable(){
    public void run(){
      map.lock("String_Node_Str");
      System.out.println("String_Node_Str");
      latch.countDown();
    }
  }
).start();
  Thread.sleep(100);
  assertEquals(1,latch.getCount());
  System.out.println("String_Node_Str");
  map.unlock("String_Node_Str");
  System.out.println("String_Node_Str");
  assertTrue(latch.await(2000,TimeUnit.MILLISECONDS));
}
Program: 50495
Project: 50495
Buggy source:
public boolean putMulti(Request req){
  Record record=getRecord(req.key);
  boolean added=true;
  if (record == null) {
    record=createNewRecord(req.key,null);
    req.key=null;
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    node.queryService.updateIndex(name,null,null,record,Integer.MIN_VALUE);
    record.addValue(req.value);
    req.value=null;
    record.setVersion(record.getVersion() + 1);
    touch(record);
    concurrentMapManager.fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,record.getKey(),req.value,record.getMapListeners());
  }
  logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  req.version=record.getVersion();
  return added;
}

Fixed version (ground truth):
public boolean putMulti(Request req){
  Record record=getRecord(req.key);
  boolean added=true;
  if (record == null) {
    record=createNewRecord(req.key,null);
    req.key=null;
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    node.queryService.updateIndex(name,null,null,record,Integer.MIN_VALUE);
    record.addValue(req.value);
    req.value=null;
    record.setVersion(record.getVersion() + 1);
    touch(record);
    concurrentMapManager.fireMapEvent(mapListeners,name,EntryEvent.TYPE_ADDED,record.getKey(),req.value,record.getMapListeners());
  }
  if (req.txnId != -1) {
    concurrentMapManager.unlock(record);
  }
  logger.log(Level.FINEST,record.getValue() + "String_Node_Str" + record.getMultiValues());
  req.version=record.getVersion();
  return added;
}
Program: 50496
Project: 50496
Buggy source:
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getCurrentTxn();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    if (!txn.has(name,key)) {
      MLock mlock=new MLock();
      boolean locked=mlock.lockAndReturnOld(name,key,DEFAULT_TXN_TIMEOUT,txn.getId());
      if (!locked)       throwCME(key);
      Object oldObject=null;
      Data oldValue=mlock.oldValue;
      if (oldValue != null) {
        oldObject=toObject(oldValue);
      }
      txn.attachPutOp(name,key,value,(oldObject == null));
      return threadContext.isClient() ? oldValue : oldObject;
    }
 else {
      return txn.attachPutOp(name,key,value,false);
    }
  }
 else {
    setLocal(operation,name,key,value,timeout,-1);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    doOp();
    Object returnObject=getResultAsObject();
    if (returnObject instanceof AddressAwareException) {
      rethrowException(operation,(AddressAwareException)returnObject);
    }
    backup(CONCURRENT_MAP_BACKUP_PUT);
    return returnObject;
  }
}

Fixed version (ground truth):
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getCurrentTxn();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    if (!txn.has(name,key)) {
      MLock mlock=new MLock();
      boolean locked=mlock.lockAndReturnOld(name,key,DEFAULT_TXN_TIMEOUT,txn.getId());
      if (!locked)       throwCME(key);
      Object oldObject=null;
      Data oldValue=mlock.oldValue;
      if (oldValue != null) {
        oldObject=toObject(oldValue);
      }
      txn.attachPutOp(name,key,value,(oldObject == null));
      return threadContext.isClient() ? oldValue : oldObject;
    }
 else {
      return txn.attachPutOp(name,key,value,false);
    }
  }
 else {
    setLocal(operation,name,key,value,timeout,-1);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    doOp();
    Object returnObject;
    returnObject=getResultAsObject();
    if (returnObject instanceof AddressAwareException) {
      rethrowException(operation,(AddressAwareException)returnObject);
    }
    backup(CONCURRENT_MAP_BACKUP_PUT);
    return returnObject;
  }
}
Program: 50497
Project: 50497
Buggy source:
/** 
 * Test case for issue 154 ExecutorService can block migration which can lead to dead-lock
 */
@Test(timeout=480000) public void testExecutorServiceAndMigration() throws Exception {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  List<DistributedTask> tasks=new ArrayList<DistributedTask>(10000);
  List<ExecutorServiceAndMigrationCallable> callables=new ArrayList<ExecutorServiceAndMigrationCallable>(10000);
  for (int i=0; i < 10000; i++) {
    ExecutorServiceAndMigrationCallable callable=new ExecutorServiceAndMigrationCallable(i);
    DistributedTask task=new DistributedTask(callable,"String_Node_Str");
    Hazelcast.getExecutorService().execute(task);
    tasks.add(task);
    callables.add(callable);
  }
  for (int i=0; i < 10000; i++) {
    ExecutorServiceAndMigrationCallable callable=callables.get(i);
    DistributedTask task=tasks.get(i);
    assertEquals(callable.getInput(),task.get(20,TimeUnit.SECONDS));
  }
}

Fixed version (ground truth):
/** 
 * Test case for issue 154
 * @throws Exception
 */
@Test(timeout=240000) public void testExecutorServiceAndMigration() throws Exception {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  List<DistributedTask> tasks=new ArrayList<DistributedTask>(10000);
  List<ExecutorServiceAndMigrationCallable> callables=new ArrayList<ExecutorServiceAndMigrationCallable>(10000);
  for (int i=0; i < 10000; i++) {
    ExecutorServiceAndMigrationCallable callable=new ExecutorServiceAndMigrationCallable(i);
    DistributedTask task=new DistributedTask(callable,"String_Node_Str");
    Hazelcast.getExecutorService().execute(task);
    tasks.add(task);
    callables.add(callable);
  }
  for (int i=0; i < 10000; i++) {
    ExecutorServiceAndMigrationCallable callable=callables.get(i);
    DistributedTask task=tasks.get(i);
    assertEquals(callable.getInput(),task.get(20,TimeUnit.SECONDS));
  }
}
Program: 50498
Project: 50498
Buggy source:
public static void init(Config config){
  if (defaultInstance != null) {
    throw new IllegalStateException("String_Node_Str");
  }
synchronized (initLock) {
    if (defaultInstance != null) {
      throw new IllegalStateException("String_Node_Str");
    }
    defaultInstance=com.hazelcast.impl.FactoryImpl.newFactory(config);
  }
}

Fixed version (ground truth):
public static void init(Config config){
  if (defaultInstance != null) {
    throw new IllegalStateException("String_Node_Str");
  }
synchronized (initLock) {
    if (defaultInstance != null) {
      throw new IllegalStateException("String_Node_Str");
    }
    defaultInstance=com.hazelcast.impl.FactoryImpl.newHazelcastInstanceProxy(config);
  }
}
Program: 50499
Project: 50499
Buggy source:
private static HazelcastInstance getDefaultInstance(){
  if (defaultInstance == null) {
synchronized (initLock) {
      if (defaultInstance == null) {
        defaultInstance=com.hazelcast.impl.FactoryImpl.newFactory(null);
      }
    }
  }
  return defaultInstance;
}

Fixed version (ground truth):
private static HazelcastInstance getDefaultInstance(){
  if (defaultInstance == null) {
synchronized (initLock) {
      if (defaultInstance == null) {
        defaultInstance=com.hazelcast.impl.FactoryImpl.newHazelcastInstanceProxy(null);
      }
    }
  }
  return defaultInstance;
}
Program: 50500
Project: 50500
Buggy source:
/** 
 * Creates a new Hazelcast instance (a new node in a cluster). This method allows you to create and run multiple instances of Hazelcast cluster members on the same JVM. <p/> To shutdown all running hazelcast instances (all members on this JVM) call   {@link #shutdownAll()}.
 * @param config Configuration for the new hazelcast instance (member)
 * @return new hazelcast instance
 * @see #shutdownAll()
 */
public static HazelcastInstance newHazelcastInstance(Config config){
  return com.hazelcast.impl.FactoryImpl.newFactory(config);
}

Fixed version (ground truth):
/** 
 * Creates a new Hazelcast instance (a new node in a cluster). This method allows you to create and run multiple instances of Hazelcast cluster members on the same JVM. <p/> To shutdown all running hazelcast instances (all members on this JVM) call   {@link #shutdownAll()}.
 * @param config Configuration for the new hazelcast instance (member)
 * @return new hazelcast instance
 * @see #shutdownAll()
 */
public static HazelcastInstance newHazelcastInstance(Config config){
  return com.hazelcast.impl.FactoryImpl.newHazelcastInstanceProxy(config);
}
Program: 50502
Project: 50502
Buggy source:
public void handleRemoteExecution(Packet packet){
  log("String_Node_Str" + packet);
  final Data callableData=IOUtil.doTake(packet.value);
  final RemoteExecutionId remoteExecutionId=new RemoteExecutionId(packet.conn.getEndPoint(),packet.longValue);
  final SimpleExecution se=new SimpleExecution(remoteExecutionId,executor,null,callableData,null,false);
  mapRemoteExecutions.put(remoteExecutionId,se);
  executor.execute(se);
  packet.returnToContainer();
}

Fixed version (ground truth):
public void handleRemoteExecution(Packet packet){
  log("String_Node_Str" + packet);
  final Data callableData=IOUtil.doTake(packet.value);
  final RemoteExecutionId remoteExecutionId=new RemoteExecutionId(packet.conn.getEndPoint(),packet.longValue);
  final SimpleExecution se=new SimpleExecution(remoteExecutionId,executor,null,callableData,null,false);
  mapRemoteExecutions.put(remoteExecutionId,se);
  executeLocally(se);
  packet.returnToContainer();
}
Program: 50503
Project: 50503
Buggy source:
public Processable createNewExecutionAction(final DistributedTask task){
  if (task == null)   throw new RuntimeException("String_Node_Str");
  try {
    final Long executionId=executionIds.take();
    final InnerFutureTask inner=(InnerFutureTask)task.getInner();
    final Callable callable=inner.getCallable();
    final Data callableData=ThreadContext.get().toData(callable);
    final DistributedExecutorAction action=new DistributedExecutorAction(executionId,task,callableData,callable);
    inner.setExecutionManagerCallback(action);
    return action;
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public Processable createNewExecutionAction(final DistributedTask task){
  if (task == null)   throw new RuntimeException("String_Node_Str");
  try {
    final Long executionId=executionIds.take();
    final InnerFutureTask inner=(InnerFutureTask)task.getInner();
    final Callable callable=inner.getCallable();
    final Data callableData=toData(callable);
    final DistributedExecutorAction action=new DistributedExecutorAction(executionId,task,callableData,callable);
    inner.setExecutionManagerCallback(action);
    return action;
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 50504
Project: 50504
Buggy source:
public void writeData(DataOutput out) throws IOException {
  out.writeUTF(name);
  out.writeUTF(factory.getName());
}

Fixed version (ground truth):
public void writeData(DataOutput out) throws IOException {
  out.writeUTF(name);
}
Program: 50505
Project: 50505
Buggy source:
public void readData(DataInput in) throws IOException {
  setName(in.readUTF());
  setFactory(getFactoryImpl(in.readUTF()));
}

Fixed version (ground truth):
public void readData(DataInput in) throws IOException {
  setName(in.readUTF());
  setFactory(ThreadContext.get().getCurrentFactory());
}
Program: 50506
Project: 50506
Buggy source:
private void beforeCall(){
  initialChecks();
  if (mproxyReal == null) {
    mproxyReal=(MProxy)factory.getOrCreateProxyByName(name);
  }
}

Fixed version (ground truth):
private void beforeCall(){
  ThreadContext.get().setCurrentFactory(factory);
  initialChecks();
  if (mproxyReal == null) {
    mproxyReal=(MProxy)factory.getOrCreateProxyByName(name);
  }
}
Program: 50507
Project: 50507
Buggy source:
public Object[] toArray(Object[] a){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public Object[] toArray(Object[] a){
  int size=size();
  if (size == 0) {
    return null;
  }
  if (a == null || a.length < size) {
    a=new Object[size];
  }
  for (int i=0; i < size; i++) {
    a[i]=toObject(lsValues.get(i));
  }
  return a;
}
Program: 50508
Project: 50508
Buggy source:
public int size(){
  return lsValues.size();
}

Fixed version (ground truth):
public int size(){
  return (lsValues == null) ? 0 : lsValues.size();
}
Program: 50509
Project: 50509
Buggy source:
public Object next(){
  Data value=it.next();
  return ThreadContext.get().toObject(value);
}

Fixed version (ground truth):
public Object next(){
  Data value=it.next();
  return toObject(value);
}
Program: 50510
Project: 50510
Buggy source:
public Object get(Object key){
  processLocalRecords();
  Record record=mapCache.get(key);
  if (record == null) {
    return OBJECT_REDO;
  }
 else {
    if (record.isActive()) {
      try {
        Object value=toObject(record.getValue());
        record.setLastAccessed();
        return value;
      }
 catch (      Throwable t) {
        logger.log(Level.FINEST,"String_Node_Str",t);
        return OBJECT_REDO;
      }
    }
 else {
      mapCache.remove(key);
      return null;
    }
  }
}

Fixed version (ground truth):
public Object get(Object key){
  processLocalRecords();
  Record record=mapCache.get(key);
  if (record == null) {
    return OBJECT_REDO;
  }
 else {
    if (record.isActive() && record.isValid()) {
      try {
        Object value=toObject(record.getValue());
        record.setLastAccessed();
        return value;
      }
 catch (      Throwable t) {
        logger.log(Level.FINEST,"String_Node_Str",t);
        return OBJECT_REDO;
      }
    }
 else {
      mapCache.remove(key);
      return OBJECT_REDO;
    }
  }
}
Program: 50511
Project: 50511
Buggy source:
public <K,V>IMap<K,V> getMap(String name){
  String prefix="String_Node_Str";
  return (IMap<K,V>)getClientProxy(prefix,name);
}

Fixed version (ground truth):
public <K,V>IMap<K,V> getMap(String name){
  String prefix=MAP_PREFIX;
  return (IMap<K,V>)getClientProxy(prefix,name);
}
Program: 50512
Project: 50512
Buggy source:
public Object getId(){
  return null;
}

Fixed version (ground truth):
public Object getId(){
  return doOp(ClusterOperation.GET_ID,null,null);
}
Program: 50513
Project: 50513
Buggy source:
public void destroy(){
  clear();
}

Fixed version (ground truth):
public void destroy(){
  doOp(ClusterOperation.DESTROY,null,null);
  this.client.destroy("String_Node_Str" + name);
}
Program: 50514
Project: 50514
Buggy source:
public void addIndex(String attribute,boolean ordered){
}

Fixed version (ground truth):
public void addIndex(String attribute,boolean ordered){
  doOp(ClusterOperation.ADD_INDEX,attribute,ordered);
}
Program: 50515
Project: 50515
Buggy source:
public void addEntryListener(EntryListener<K,V> listener,K key,boolean includeValue){
  if (key != null) {
    if (client.listenerManager.mapOfListeners.containsKey(name) && client.listenerManager.mapOfListeners.get(name).containsKey(null) && client.listenerManager.mapOfListeners.get(name).get(null).size() > 0) {
      client.listenerManager.registerEntryListener(name,key,listener);
      return;
    }
  }
  Packet request=createRequestPacket(ClusterOperation.ADD_LISTENER,toByte(key),null);
  request.setLongValue(includeValue ? 1 : 0);
  Call c=createCall(request);
  client.listenerManager.addListenerCall(c);
  doCall(c);
  client.listenerManager.registerEntryListener(name,key,listener);
}

Fixed version (ground truth):
public void addEntryListener(EntryListener<K,V> listener,K key,boolean includeValue){
  Packet request=createRequestPacket(ClusterOperation.ADD_LISTENER,toByte(key),null);
  request.setLongValue(includeValue ? 1 : 0);
  Call c=createCall(request);
  client.listenerManager.addListenerCall(c);
  doCall(c);
  client.listenerManager.registerEntryListener(name,key,listener);
}
Program: 50516
Project: 50516
Buggy source:
protected void customRun() throws InterruptedException {
  Packet packet=queue.poll(100,TimeUnit.MILLISECONDS);
  if (packet == null) {
    return;
  }
  EntryEvent event=new EntryEvent(packet.getName(),(int)packet.getLongValue(),Serializer.toObject(packet.getKey()),Serializer.toObject(packet.getValue()));
  fireEvent(event);
}

Fixed version (ground truth):
protected void customRun() throws InterruptedException {
  Packet packet=queue.poll(100,TimeUnit.MILLISECONDS);
  if (packet == null) {
    return;
  }
  EntryEvent event=new EntryEvent(packet.getName(),(int)packet.getLongValue(),toObject(packet.getKey()),toObject(packet.getValue()));
  fireEvent(event);
}
Program: 50517
Project: 50517
Buggy source:
private void fireEvent(EntryEvent event){
  String name=event.getName();
  Object key=event.getKey();
  System.out.println(event);
  if (mapOfListeners.get(name.substring(2)) != null) {
    notifyListeners(event,mapOfListeners.get(name.substring(2)).get(null));
    notifyListeners(event,mapOfListeners.get(name.substring(2)).get(key));
  }
}

Fixed version (ground truth):
private void fireEvent(EntryEvent event){
  String name=event.getName();
  Object key=event.getKey();
  if (mapOfListeners.get(name.substring(2)) != null) {
    notifyListeners(event,mapOfListeners.get(name.substring(2)).get(null));
    notifyListeners(event,mapOfListeners.get(name.substring(2)).get(key));
  }
}
Program: 50518
Project: 50518
Buggy source:
@Test @Ignore public void addTwoListener1stToKeyOtherToMap() throws InterruptedException, IOException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap<String,String> map=hClient.getMap("String_Node_Str");
  final CountDownLatch entryAddLatch=new CountDownLatch(5);
  final CountDownLatch entryUpdatedLatch=new CountDownLatch(5);
  final CountDownLatch entryRemovedLatch=new CountDownLatch(5);
  CountDownLatchEntryListener<String,String> listener1=new CountDownLatchEntryListener<String,String>(entryAddLatch,entryUpdatedLatch,entryRemovedLatch);
  CountDownLatchEntryListener<String,String> listener2=new CountDownLatchEntryListener<String,String>(entryAddLatch,entryUpdatedLatch,entryRemovedLatch);
  map.addEntryListener(listener2,"String_Node_Str",true);
  map.addEntryListener(listener1,true);
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.remove("String_Node_Str");
  Thread.sleep(100);
  assertEquals(3,entryAddLatch.getCount());
  assertEquals(3,entryRemovedLatch.getCount());
  assertEquals(3,entryUpdatedLatch.getCount());
}

Fixed version (ground truth):
@Test public void addTwoListener1stToKeyOtherToMap() throws InterruptedException, IOException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap<String,String> map=hClient.getMap("String_Node_Str");
  final CountDownLatch entryAddLatch=new CountDownLatch(5);
  final CountDownLatch entryUpdatedLatch=new CountDownLatch(5);
  final CountDownLatch entryRemovedLatch=new CountDownLatch(5);
  CountDownLatchEntryListener<String,String> listener1=new CountDownLatchEntryListener<String,String>(entryAddLatch,entryUpdatedLatch,entryRemovedLatch);
  CountDownLatchEntryListener<String,String> listener2=new CountDownLatchEntryListener<String,String>(entryAddLatch,entryUpdatedLatch,entryRemovedLatch);
  map.addEntryListener(listener2,"String_Node_Str",true);
  map.addEntryListener(listener1,true);
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.remove("String_Node_Str");
  Thread.sleep(100);
  assertEquals(3,entryAddLatch.getCount());
  assertEquals(3,entryRemovedLatch.getCount());
  assertEquals(3,entryUpdatedLatch.getCount());
}
Program: 50519
Project: 50519
Buggy source:
@Test @Ignore public void lockMap() throws InterruptedException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap map=hClient.getMap("String_Node_Str");
  final CountDownLatch latch=new CountDownLatch(1);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(1000);
  System.out.println("String_Node_Str");
  map.lock("String_Node_Str");
  System.out.println("String_Node_Str");
  new Thread(new Runnable(){
    public void run(){
      map.lock("String_Node_Str");
      System.out.println("String_Node_Str");
      latch.countDown();
    }
  }
).start();
  Thread.sleep(100);
  assertEquals(1,latch.getCount());
  System.out.println("String_Node_Str");
  map.unlock("String_Node_Str");
  System.out.println("String_Node_Str");
  assertTrue(latch.await(2000,TimeUnit.MILLISECONDS));
}

Fixed version (ground truth):
@Test public void lockMap() throws InterruptedException {
  HazelcastInstance h=Hazelcast.newHazelcastInstance(null);
  hClient=getHazelcastClient(h);
  final IMap map=hClient.getMap("String_Node_Str");
  final CountDownLatch latch=new CountDownLatch(1);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(1000);
  System.out.println("String_Node_Str");
  map.lock("String_Node_Str");
  System.out.println("String_Node_Str" + Thread.currentThread().getId());
  new Thread(new Runnable(){
    public void run(){
      map.lock("String_Node_Str");
      System.out.println("String_Node_Str" + Thread.currentThread().getId());
      latch.countDown();
    }
  }
).start();
  Thread.sleep(100);
  assertEquals(1,latch.getCount());
  System.out.println("String_Node_Str");
  map.unlock("String_Node_Str");
  System.out.println("String_Node_Str");
  assertTrue(latch.await(2000,TimeUnit.MILLISECONDS));
}
Program: 50520
Project: 50520
Buggy source:
public void addThisAsListener(IMap map,Object key,boolean includeValue){
  if (key == null) {
    map.addEntryListener(this,includeValue);
  }
 else {
    map.addEntryListener(this,key,includeValue);
  }
}

Fixed version (ground truth):
public void addThisAsListener(IMap map,Object key,boolean includeValue){
  String name=((MProxy)map).getLongName();
  Map<Object,EntryEvent> eventProcessedLog=getEventProcessedLog(name);
  if (key == null) {
    map.addEntryListener(this,includeValue);
  }
 else {
    map.addEntryListener(this,key,includeValue);
  }
}
Program: 50522
Project: 50522
Buggy source:
private void processEvent(EntryEvent event){
  Packet packet=createEventPacket(event);
  sendPacket(packet);
}

Fixed version (ground truth):
private void processEvent(EntryEvent event){
  Map<Object,EntryEvent> eventProcessedLog=getEventProcessedLog(event.getName());
  if (eventProcessedLog.get(event.getKey()) != null && eventProcessedLog.get(event.getKey()) == event) {
    return;
  }
  eventProcessedLog.put(event.getKey(),event);
  Object key=listeneds.get(event.getName());
  if (key == null) {
  }
  Packet packet=createEventPacket(event);
  sendPacket(packet);
}
Program: 50523
Project: 50523
Buggy source:
public CallContext getCallContext(int threadId){
  CallContext context=mapOfCallContexts.get(threadId);
  if (context == null) {
    int locallyMappedThreadId=ThreadContext.get().createNewThreadId();
    context=new CallContext(locallyMappedThreadId,true);
    mapOfCallContexts.put(threadId,context);
  }
  return context;
}

Fixed version (ground truth):
public CallContext getCallContext(int threadId){
  CallContext context=callContexts.get(threadId);
  if (context == null) {
    int locallyMappedThreadId=ThreadContext.get().createNewThreadId();
    context=new CallContext(locallyMappedThreadId,true);
    callContexts.put(threadId,context);
  }
  return context;
}
Program: 50524
Project: 50524
Buggy source:
public boolean backup(Request req){
  if (req.key == null || req.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.key);
  }
  Record record=getRecord(req.key);
  if (record != null) {
    if (req.version > record.getVersion() + 1) {
      Request reqCopy=new Request();
      reqCopy.setFromRequest(req,true);
      req.key=null;
      req.value=null;
      record.addBackupOp(new VersionedBackupOp(this,reqCopy));
      return true;
    }
 else     if (req.version <= record.getVersion()) {
      return false;
    }
  }
  doBackup(req);
  if (record != null) {
    record.setVersion(req.version);
    record.runBackupOps();
  }
  return true;
}

Fixed version (ground truth):
public boolean backup(Request req){
  if (req.key == null || req.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.key);
  }
  Record record=getRecord(req.key);
  if (record != null) {
    record.setActive();
    if (req.version > record.getVersion() + 1) {
      Request reqCopy=new Request();
      reqCopy.setFromRequest(req,true);
      req.key=null;
      req.value=null;
      record.addBackupOp(new VersionedBackupOp(this,reqCopy));
      return true;
    }
 else     if (req.version <= record.getVersion()) {
      return false;
    }
  }
  doBackup(req);
  if (record != null) {
    record.setVersion(req.version);
    record.runBackupOps();
  }
  return true;
}
Program: 50525
Project: 50525
Buggy source:
public void own(Request req){
  if (req.key == null || req.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.key);
  }
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=toRecord(req);
  markAsOwned(record);
  updateIndexes(true,req,record);
  record.setVersion(req.version);
}

Fixed version (ground truth):
public void own(Request req){
  if (req.key == null || req.key.size() == 0) {
    throw new RuntimeException("String_Node_Str" + req.key);
  }
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=toRecord(req);
  markAsActive(record);
  markAsOwned(record);
  updateIndexes(true,req,record);
  record.setVersion(req.version);
}
Program: 50526
Project: 50526
Buggy source:
int getBlockId(Data key){
  int hash=key.hashCode();
  return Math.abs(hash) % BLOCK_COUNT;
}

Fixed version (ground truth):
public int getBlockId(Data key){
  int hash=key.hashCode();
  return Math.abs(hash) % BLOCK_COUNT;
}
Program: 50527
Project: 50527
Buggy source:
public <T>Future<T> submit(Runnable task,T result){
  DistributedTask dtask;
  if (task instanceof DistributedTask) {
    dtask=(DistributedTask)task;
  }
 else {
    dtask=new DistributedTask(task,result);
  }
  Processable action=node.executorManager.createNewExecutionAction(dtask);
  ClusterService clusterService=node.clusterService;
  clusterService.enqueueAndReturn(action);
  return dtask;
}

Fixed version (ground truth):
public <T>Future<T> submit(Runnable task,T result){
  DistributedTask dtask;
  if (task instanceof DistributedTask) {
    dtask=(DistributedTask)task;
  }
 else {
    check(task);
    dtask=new DistributedTask(task,result);
  }
  Processable action=node.executorManager.createNewExecutionAction(dtask);
  ClusterService clusterService=node.clusterService;
  clusterService.enqueueAndReturn(action);
  return dtask;
}
Program: 50528
Project: 50528
Buggy source:
public void execute(Runnable command){
  DistributedTask dtask;
  if (command instanceof DistributedTask) {
    dtask=(DistributedTask)command;
  }
 else {
    dtask=new DistributedTask(command,null);
  }
  Processable action=node.executorManager.createNewExecutionAction(dtask);
  node.clusterService.enqueueAndReturn(action);
}

Fixed version (ground truth):
public void execute(Runnable command){
  DistributedTask dtask;
  if (command instanceof DistributedTask) {
    dtask=(DistributedTask)command;
  }
 else {
    check(command);
    dtask=new DistributedTask(command,null);
  }
  Processable action=node.executorManager.createNewExecutionAction(dtask);
  node.clusterService.enqueueAndReturn(action);
}
Program: 50529
Project: 50529
Buggy source:
public HazelcastInstanceProxy(FactoryImpl factory){
  this.factory=factory;
}

Fixed version (ground truth):
public HazelcastInstanceProxy(FactoryImpl factory){
  this.hazelcastInstance=factory;
}
Program: 50530
Project: 50530
Buggy source:
public String toString(){
  return "String_Node_Str" + getKey() + "String_Node_Str"+ isRemovable();
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + getKey() + "String_Node_Str"+ isRemovable()+ "String_Node_Str"+ isActive()+ "String_Node_Str"+ isValid();
}
Program: 50533
Project: 50533
Buggy source:
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getCurrentTxn();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    try {
      if (!txn.has(name,key)) {
        MLock mlock=new MLock();
        boolean locked=mlock.lockAndReturnOld(name,key,DEFAULT_TXN_TIMEOUT,txn.getId());
        if (!locked)         throwCME(key);
        Object oldObject=null;
        Data oldValue=mlock.oldValue;
        if (oldValue != null) {
          oldObject=toObject(oldValue);
        }
        txn.attachPutOp(name,key,value,(oldObject == null));
        return threadContext.isClient() ? oldValue : oldObject;
      }
 else {
        return txn.attachPutOp(name,key,value,false);
      }
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
    return null;
  }
 else {
    setLocal(operation,name,key,value,timeout,-1);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    doOp();
    Object oldValue=getResultAsObject();
    if (oldValue instanceof AddressAwareException) {
      rethrowException(operation,(AddressAwareException)oldValue);
    }
    backup(CONCURRENT_MAP_BACKUP_PUT);
    return oldValue;
  }
}

Fixed version (ground truth):
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getCurrentTxn();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    if (!txn.has(name,key)) {
      MLock mlock=new MLock();
      boolean locked=mlock.lockAndReturnOld(name,key,DEFAULT_TXN_TIMEOUT,txn.getId());
      if (!locked)       throwCME(key);
      Object oldObject=null;
      Data oldValue=mlock.oldValue;
      if (oldValue != null) {
        oldObject=toObject(oldValue);
      }
      txn.attachPutOp(name,key,value,(oldObject == null));
      return threadContext.isClient() ? oldValue : oldObject;
    }
 else {
      return txn.attachPutOp(name,key,value,false);
    }
  }
 else {
    setLocal(operation,name,key,value,timeout,-1);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    doOp();
    Object returnObject=getResultAsObject();
    if (returnObject instanceof AddressAwareException) {
      rethrowException(operation,(AddressAwareException)returnObject);
    }
    backup(CONCURRENT_MAP_BACKUP_PUT);
    return returnObject;
  }
}
Program: 50534
Project: 50534
Buggy source:
public boolean replace(Object key,Object oldValue,Object newValue){
  check(key);
  check(newValue);
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public boolean replace(Object key,Object oldValue,Object newValue){
  check(key);
  check(oldValue);
  check(newValue);
  MPut mput=concurrentMapManager.new MPut();
  return mput.replace(name,key,oldValue,newValue,-1);
}
Program: 50535
Project: 50535
Buggy source:
public Object get(final String name,final Object key){
  final TransactionRecord rec=findTransactionRecord(name,key);
  if (rec == null)   return null;
  if (rec.removed)   return null;
  return rec.value;
}

Fixed version (ground truth):
public Object get(final String name,final Object key){
  final TransactionRecord rec=findTransactionRecord(name,key);
  if (rec == null)   return null;
  if (rec.removed)   return null;
  rec.lastAccess=System.currentTimeMillis();
  return rec.value;
}
Program: 50537
Project: 50537
Buggy source:
@Test public void continuePutAndGetIfOneOfConnectedClusterMemberFails() throws InterruptedException, IOException {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(null);
  client=getHazelcastClient(h1,h2);
  Map realMap=h3.getMap("String_Node_Str");
  Map<Integer,HazelcastInstance> memberMap=getMapOfClustorMembers(h1,h2);
  Map<String,Integer> map=client.getMap("String_Node_Str");
  int counter=0;
  while (counter < 2) {
    map.put("String_Node_Str",counter);
    assertEquals(counter,realMap.get("String_Node_Str"));
    assertEquals(counter,map.get("String_Node_Str"));
    memberMap.get(client.getConnectionManager().getConnection().getAddress().getPort()).shutdown();
    counter++;
  }
}

Fixed version (ground truth):
@Test public void continuePutAndGetIfOneOfConnectedClusterMemberFails() throws InterruptedException, IOException {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(null);
  client=getHazelcastClient(h1,h2);
  Map realMap=h3.getMap("String_Node_Str");
  Map<Integer,HazelcastInstance> memberMap=getMapOfClusterMembers(h1,h2);
  Map map=client.getMap("String_Node_Str");
  int counter=0;
  while (counter < 2) {
    map.put("String_Node_Str",counter);
    assertEquals(counter,realMap.get("String_Node_Str"));
    assertEquals(counter,map.get("String_Node_Str"));
    memberMap.get(client.getConnectionManager().getConnection().getAddress().getPort()).shutdown();
    counter++;
  }
}
Program: 50538
Project: 50538
Buggy source:
@Test(expected=RuntimeException.class) public void throwsRuntimeExceptionWhenNoMemberToConnect() throws InterruptedException, IOException {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(null);
  Map realMap=h3.getMap("String_Node_Str");
  Map<Integer,HazelcastInstance> memberMap=getMapOfClustorMembers(h1,h2);
  client=getHazelcastClient(h1,h2);
  Map<String,Integer> map=client.getMap("String_Node_Str");
  int counter=0;
  realMap.get("String_Node_Str");
  while (counter < 3) {
    System.out.println("String_Node_Str" + counter);
    map.put("String_Node_Str",counter);
    assertEquals(counter,map.get("String_Node_Str"));
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    assertEquals(counter,realMap.get("String_Node_Str"));
    memberMap.get(client.getConnectionManager().getConnection().getAddress().getPort()).shutdown();
    System.out.println("String_Node_Str");
    counter++;
  }
}

Fixed version (ground truth):
@Test(expected=RuntimeException.class) public void throwsRuntimeExceptionWhenNoMemberToConnect() throws InterruptedException, IOException {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance h3=Hazelcast.newHazelcastInstance(null);
  Map realMap=h3.getMap("String_Node_Str");
  Map<Integer,HazelcastInstance> memberMap=getMapOfClusterMembers(h1,h2);
  client=getHazelcastClient(h1,h2);
  Map map=client.getMap("String_Node_Str");
  int counter=0;
  realMap.get("String_Node_Str");
  while (counter < 3) {
    System.out.println("String_Node_Str" + counter);
    map.put("String_Node_Str",counter);
    assertEquals(counter,map.get("String_Node_Str"));
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    assertEquals(counter,realMap.get("String_Node_Str"));
    memberMap.get(client.getConnectionManager().getConnection().getAddress().getPort()).shutdown();
    System.out.println("String_Node_Str");
    counter++;
  }
}
Program: 50539
Project: 50539
Buggy source:
public void begin() throws ResourceException {
  log(this,"String_Node_Str");
  ThreadContext.get().getTransaction().begin();
  fireConnectionEvent(ConnectionEvent.LOCAL_TRANSACTION_STARTED);
}

Fixed version (ground truth):
public void begin() throws ResourceException {
  log(this,"String_Node_Str");
  Hazelcast.getTransaction().begin();
  fireConnectionEvent(ConnectionEvent.LOCAL_TRANSACTION_STARTED);
}