nus-yam/ex-repair huggingface dataset:
Program: 49940
Project: 49940
Buggy source:
public void entryAdded(EntryEvent<E,V> event){
  itemListener.itemAdded(event.getKey());
}

Fixed version (ground truth):
public void entryAdded(EntryEvent<E,V> event){
  itemListener.itemAdded(event.getValue());
}
Program: 49941
Project: 49941
Buggy source:
public void entryRemoved(EntryEvent<E,V> event){
  itemListener.itemRemoved(event.getKey());
}

Fixed version (ground truth):
public void entryRemoved(EntryEvent<E,V> event){
  itemListener.itemRemoved(event.getValue());
}
Program: 49942
Project: 49942
Buggy source:
public synchronized <E,V>void registerListener(String name,final ItemListener<E> itemListener){
  EntryListener<E,V> e=new EntryAdapter<E,V>(){
    public void entryAdded(    EntryEvent<E,V> event){
      itemListener.itemAdded(event.getKey());
    }
    public void entryRemoved(    EntryEvent<E,V> event){
      itemListener.itemRemoved(event.getKey());
    }
  }
;
  entryListenerManager.registerListener(name,null,false,e);
  itemListener2EntryListener.put(itemListener,e);
}

Fixed version (ground truth):
public synchronized <E,V>void registerListener(String name,final ItemListener<V> itemListener){
  EntryListener<E,V> e=new EntryAdapter<E,V>(){
    public void entryAdded(    EntryEvent<E,V> event){
      itemListener.itemAdded(event.getValue());
    }
    public void entryRemoved(    EntryEvent<E,V> event){
      itemListener.itemRemoved(event.getValue());
    }
  }
;
  entryListenerManager.registerListener(name,null,true,e);
  itemListener2EntryListener.put(itemListener,e);
}
Program: 49943
Project: 49943
Buggy source:
@Test public void clear(){
  HazelcastClient hClient=getHazelcastClient();
  IList<Integer> list=hClient.getList("String_Node_Str");
  int count=100;
  assertTrue(list.isEmpty());
  for (int i=0; i < count; i++) {
    assertTrue(list.add(i));
  }
  assertEquals(count,list.size());
  list.clear();
  assertTrue(list.isEmpty());
}

Fixed version (ground truth):
@Test public void clear(){
  HazelcastClient hClient=getHazelcastClient();
  IList<Integer> list=hClient.getList("String_Node_Str");
  int count=100;
  assertTrue(list.isEmpty());
  for (int i=0; i < count; i++) {
    assertTrue(list.add(i));
  }
  assertEquals(count,list.size());
  list.clear();
  assertTrue("String_Node_Str" + list.size(),list.isEmpty());
}
Program: 49944
Project: 49944
Buggy source:
@Test public void iterate(){
  HazelcastClient hClient=getHazelcastClient();
  IList<Integer> 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,(Integer)counter.get(integer) - 1);
    iterator.remove();
  }
  assertEquals(Integer.valueOf(0),counter.get(1));
  assertEquals(Integer.valueOf(0),counter.get(2));
  assertEquals(Integer.valueOf(0),counter.get(3));
  assertTrue(list.isEmpty());
}

Fixed version (ground truth):
@Test public void iterate(){
  HazelcastClient hClient=getHazelcastClient();
  IList<Integer> 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=iterator.next();
    counter.put(integer,counter.get(integer) - 1);
    iterator.remove();
  }
  assertEquals(Integer.valueOf(0),counter.get(1));
  assertEquals(Integer.valueOf(0),counter.get(2));
  assertEquals(Integer.valueOf(0),counter.get(3));
  assertTrue(list.isEmpty());
}
Program: 49945
Project: 49945
Buggy source:
public static InstanceType getInstanceType(final String name){
  if (name.startsWith(Prefix.QUEUE)) {
    return InstanceType.QUEUE;
  }
 else   if (name.startsWith(Prefix.TOPIC)) {
    return InstanceType.TOPIC;
  }
 else   if (name.startsWith(Prefix.MAP)) {
    return InstanceType.MAP;
  }
 else   if (name.startsWith(Prefix.MAP_BASED)) {
    if (name.length() > 3) {
      final String typeStr=name.substring(2,4);
      if (Prefix.AS_SET.equals(typeStr)) {
        return InstanceType.SET;
      }
 else       if (Prefix.AS_LIST.equals(typeStr)) {
        return InstanceType.LIST;
      }
 else       if (Prefix.AS_MULTIMAP.equals(typeStr)) {
        return InstanceType.MULTIMAP;
      }
    }
    return InstanceType.MAP;
  }
 else {
    throw new RuntimeException("String_Node_Str" + name);
  }
}

Fixed version (ground truth):
public static InstanceType getInstanceType(final String name){
  if (name.startsWith(Prefix.QUEUE)) {
    return InstanceType.QUEUE;
  }
 else   if (name.startsWith(Prefix.TOPIC)) {
    return InstanceType.TOPIC;
  }
 else   if (name.startsWith(Prefix.MAP)) {
    return InstanceType.MAP;
  }
 else   if (name.startsWith(Prefix.AS_LIST)) {
    return InstanceType.LIST;
  }
 else   if (name.startsWith(Prefix.MAP_BASED)) {
    if (name.length() > 3) {
      final String typeStr=name.substring(2,4);
      if (Prefix.AS_SET.equals(typeStr)) {
        return InstanceType.SET;
      }
 else       if (Prefix.AS_MULTIMAP.equals(typeStr)) {
        return InstanceType.MULTIMAP;
      }
    }
    return InstanceType.MAP;
  }
 else {
    throw new RuntimeException("String_Node_Str" + name);
  }
}
Program: 49946
Project: 49946
Buggy source:
Packet createEntryEventPacket(EntryEvent event){
  Packet packet=new Packet();
  DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
  Data valueEvent=null;
  if (dataAwareEntryEvent.getNewValueData() != null) {
    Keys keys=new Keys();
    keys.add(dataAwareEntryEvent.getNewValueData());
    keys.add(dataAwareEntryEvent.getOldValueData());
    valueEvent=toData(keys);
  }
  packet.set(event.getName(),ClusterOperation.EVENT,dataAwareEntryEvent.getKeyData(),valueEvent);
  packet.longValue=event.getEventType().getType();
  return packet;
}

Fixed version (ground truth):
Packet createEntryEventPacket(EntryEvent event){
  Packet packet=new Packet();
  DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
  Data valueEvent=null;
  if (dataAwareEntryEvent.getNewValueData() != null) {
    Keys keys=new Keys();
    keys.add(dataAwareEntryEvent.getNewValueData());
    keys.add(dataAwareEntryEvent.getOldValueData());
    valueEvent=toData(keys);
  }
  String name=event.getName();
  if (name.startsWith(Prefix.MAP_OF_LIST)) {
    name=name.substring(Prefix.MAP.length() + Prefix.QUEUE.length());
    valueEvent=((DataAwareEntryEvent)event).getNewValueData();
  }
  packet.set(name,ClusterOperation.EVENT,dataAwareEntryEvent.getKeyData(),valueEvent);
  packet.longValue=event.getEventType().getType();
  return packet;
}
Program: 49947
Project: 49947
Buggy source:
public Map<K,V> getAll(Set<K> setKeys){
  check(setKeys);
  Keys keys=new Keys();
  for (  K key : setKeys) {
    keys.add(toData(key));
  }
  Pairs pairs=(Pairs)proxyHelper.doOp(ClusterOperation.CONCURRENT_MAP_GET_ALL,keys,null);
  List<KeyValue> lsKeyValues=pairs.getKeyValues();
  Map map=new HashMap();
  for (  KeyValue keyValue : lsKeyValues) {
    map.put(toObject(keyValue.getKeyData()),toObject(keyValue.getValueData()));
  }
  return map;
}

Fixed version (ground truth):
public Map<K,V> getAll(Set<K> setKeys){
  check(setKeys);
  Keys keys=new Keys();
  for (  K key : setKeys) {
    keys.add(toData(key));
  }
  Pairs pairs=(Pairs)proxyHelper.doOp(ClusterOperation.CONCURRENT_MAP_GET_ALL,keys,null);
  List<KeyValue> lsKeyValues=pairs.getKeyValues();
  Map map=new HashMap();
  if (lsKeyValues != null) {
    for (    KeyValue keyValue : lsKeyValues) {
      map.put(toObject(keyValue.getKeyData()),toObject(keyValue.getValueData()));
    }
  }
  return map;
}
Program: 49948
Project: 49948
Buggy source:
public <K,V,E>Object getClientProxy(Object o){
  Object proxy=mapProxies.get(o);
  if (proxy == null) {
synchronized (mapProxies) {
      proxy=mapProxies.get(o);
      if (proxy == null) {
        if (o instanceof String) {
          String name=(String)o;
          if (name.startsWith(Prefix.MAP)) {
            proxy=new MapClientProxy<K,V>(this,name);
          }
 else           if (name.startsWith(Prefix.AS_LIST)) {
            proxy=new ListClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.SET)) {
            proxy=new SetClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.QUEUE)) {
            proxy=new QueueClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.TOPIC)) {
            proxy=new TopicClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.ATOMIC_NUMBER)) {
            proxy=new AtomicNumberClientProxy(this,name);
          }
 else           if (name.startsWith(Prefix.IDGEN)) {
            proxy=new IdGeneratorClientProxy(this,name);
          }
 else           if (name.startsWith(Prefix.MULTIMAP)) {
            proxy=new MultiMapClientProxy(this,name);
          }
 else {
            proxy=new LockClientProxy(o,this);
          }
          mapProxies.put(o,proxy);
        }
 else {
          proxy=new LockClientProxy(o,this);
        }
      }
    }
  }
  return mapProxies.get(o);
}

Fixed version (ground truth):
public <K,V,E>Object getClientProxy(Object o){
  Object proxy=mapProxies.get(o);
  if (proxy == null) {
synchronized (mapProxies) {
      proxy=mapProxies.get(o);
      if (proxy == null) {
        if (o instanceof String) {
          String name=(String)o;
          if (name.startsWith(Prefix.MAP)) {
            proxy=new MapClientProxy<K,V>(this,name);
          }
 else           if (name.startsWith(Prefix.AS_LIST)) {
            proxy=new ListClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.SET)) {
            proxy=new SetClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.QUEUE)) {
            proxy=new QueueClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.TOPIC)) {
            proxy=new TopicClientProxy<E>(this,name);
          }
 else           if (name.startsWith(Prefix.ATOMIC_NUMBER)) {
            proxy=new AtomicNumberClientProxy(this,name);
          }
 else           if (name.startsWith(Prefix.IDGEN)) {
            proxy=new IdGeneratorClientProxy(this,name);
          }
 else           if (name.startsWith(Prefix.MULTIMAP)) {
            proxy=new MultiMapClientProxy(this,name);
          }
 else           if (name.startsWith(Prefix.SEMAPHORE)) {
            proxy=new SemaphoreClientProxy(this,name);
          }
 else {
            proxy=new LockClientProxy(o,this);
          }
          mapProxies.put(o,proxy);
        }
 else {
          proxy=new LockClientProxy(o,this);
        }
      }
    }
  }
  return mapProxies.get(o);
}
Program: 49949
Project: 49949
Buggy source:
public Semaphore getSemaphore(String name){
  return (Semaphore)getClientProxy(Prefix.SEMAPHORE + name);
}

Fixed version (ground truth):
public ISemaphore getSemaphore(String name){
  ISemaphore semaphore=(ISemaphore)getClientProxy(Prefix.SEMAPHORE + name);
  return semaphore;
}
Program: 49950
Project: 49950
Buggy source:
@Override public Session findSession(String id) throws IOException {
  Session session=super.findSession(id);
  if (session != null) {
    return session;
  }
  HazelcastAttribute mark=(HazelcastAttribute)hazelAttributes.get(id + "String_Node_Str" + HAZEL_SESSION_MARK);
  if (mark != null && mark.getValue() != null) {
    session=createSession(id);
  }
  return session;
}

Fixed version (ground truth):
@Override public Session findSession(String id) throws IOException {
  Session session=super.findSession(id);
  if (session != null) {
    return session;
  }
  final IMap<String,HazelcastAttribute> sessionAttrMap=HazelcastClusterSupport.get().getAttributesMap();
  HazelcastAttribute mark=sessionAttrMap.get(id + "String_Node_Str" + HazelcastSession.SESSION_MARK);
  if (mark != null && mark.getValue() != null) {
    session=createSession(id);
  }
  return session;
}
Program: 49951
Project: 49951
Buggy source:
public void addListener(String name,Object listener,Object key,boolean includeValue,Instance.InstanceType instanceType){
  boolean remotelyRegister=true;
  for (  ListenerItem listenerItem : listeners) {
    if (!remotelyRegister) {
      break;
    }
    if (listenerItem.name.equals(name)) {
      if (key == null) {
        if (listenerItem.key == null && (!includeValue || listenerItem.includeValue == includeValue)) {
          remotelyRegister=false;
        }
      }
 else       if (listenerItem.key != null) {
        if (listenerItem.key.equals(key) && (!includeValue || listenerItem.includeValue == includeValue)) {
          remotelyRegister=false;
        }
      }
    }
  }
  if (remotelyRegister) {
    registerListener(name,key,true,includeValue);
  }
  ListenerItem listenerItem=new ListenerItem(name,key,listener,includeValue,instanceType);
  listeners.add(listenerItem);
}

Fixed version (ground truth):
public void addListener(String name,Object listener,Object key,boolean includeValue,Instance.InstanceType instanceType){
  boolean remotelyRegister=true;
  for (  ListenerItem listenerItem : listeners) {
    if (!remotelyRegister) {
      break;
    }
    if (!listenerItem.localListener && listenerItem.name.equals(name)) {
      if (key == null) {
        if (listenerItem.key == null && (!includeValue || listenerItem.includeValue == includeValue)) {
          remotelyRegister=false;
        }
      }
 else       if (listenerItem.key != null) {
        if (listenerItem.key.equals(key) && (!includeValue || listenerItem.includeValue == includeValue)) {
          remotelyRegister=false;
        }
      }
    }
  }
  if (remotelyRegister) {
    registerListener(name,key,true,includeValue);
  }
  ListenerItem listenerItem=new ListenerItem(name,key,listener,includeValue,instanceType);
  listeners.add(listenerItem);
}
Program: 49953
Project: 49953
Buggy source:
public void entryAdded(EntryEvent<Integer,DataSerializableUser> entryEvent){
  DataSerializableUser u=entryEvent.getValue();
  assertEquals(user.getName(),u.getName());
  assertEquals(user.getFamilyName(),u.getFamilyName());
  assertEquals(user.getAge(),u.getAge());
  assertEquals(user.getAddress().getAddress(),u.getAddress().getAddress());
  cdl.countDown();
}

Fixed version (ground truth):
public void entryAdded(EntryEvent<Object,Object> event){
  this.entryUpdated(event);
}
Program: 49954
Project: 49954
Buggy source:
public void run(){
  int count=0;
  try {
    System.out.println(Thread.currentThread() + "String_Node_Str");
    HazelcastClient client;
synchronized (finished) {
      client=HazelcastClient.newHazelcastClient("String_Node_Str","String_Node_Str","String_Node_Str");
    }
    System.out.println(Thread.currentThread() + "String_Node_Str");
    startUpLatch.countDown();
    startUpLatch.await();
    while (!finished.get()) {
      queue.take();
      client.getMap("String_Node_Str").put(latch.getCount(),latch.getCount());
      count++;
      latch.countDown();
    }
  }
 catch (  InterruptedException e) {
    return;
  }
  System.out.println(Thread.currentThread() + "String_Node_Str" + count);
}

Fixed version (ground truth):
public void run(){
synchronized (latch) {
    h.getMap("String_Node_Str").put("String_Node_Str",counter1.incrementAndGet());
    latch.countDown();
  }
}
Program: 49956
Project: 49956
Buggy source:
private Data takeKey(String name,int index,long timeout) throws InterruptedException {
  try {
    MasterOp op=new MasterOp(ClusterOperation.BLOCKING_TAKE_KEY,name,timeout);
    op.request.longValue=index;
    op.initOp();
    return (Data)op.getResultAsIs();
  }
 catch (  Exception e) {
    if (e instanceof RuntimeInterruptedException) {
      throw new InterruptedException();
    }
  }
  return null;
}

Fixed version (ground truth):
private Data takeKey(String name,int index,long timeout) throws InterruptedException {
  try {
    MasterOp op=new MasterOp(ClusterOperation.BLOCKING_TAKE_KEY,name,timeout);
    op.request.longValue=index;
    op.request.txnId=ThreadContext.get().getThreadId();
    op.initOp();
    return (Data)op.getResultAsIs();
  }
 catch (  Exception e) {
    if (e instanceof RuntimeInterruptedException) {
      MasterOp op=new MasterOp(ClusterOperation.BLOCKING_CANCEL_TAKE_KEY,name,timeout);
      op.request.longValue=index;
      op.request.txnId=ThreadContext.get().getThreadId();
      op.initOp();
      throw new InterruptedException();
    }
  }
  return null;
}
Program: 49957
Project: 49957
Buggy source:
void doTakeKey(Request req){
  QData qdata=null;
  if (req.longValue > 0) {
    qdata=removeItemByIndex((int)req.longValue);
  }
 else {
    qdata=pollValidItem();
  }
  if (qdata != null) {
    keys.remove(qdata.data);
    req.response=qdata.data;
    returnResponse(req);
    offerOne();
  }
 else {
    if (req.hasEnoughTimeToSchedule()) {
      addPollAction(new PollAction(req));
    }
 else {
      req.response=null;
      returnResponse(req);
    }
  }
}

Fixed version (ground truth):
void doTakeKey(Request req){
  QData qdata;
  if (req.longValue > 0) {
    qdata=removeItemByIndex((int)req.longValue);
  }
 else {
    qdata=pollValidItem();
  }
  if (qdata != null) {
    keys.remove(qdata.data);
    req.response=qdata.data;
    returnResponse(req);
    offerOne();
  }
 else {
    if (req.hasEnoughTimeToSchedule()) {
      addPollAction(new PollAction(req));
    }
 else {
      req.response=null;
      returnResponse(req);
    }
  }
}
Program: 49958
Project: 49958
Buggy source:
public long generateKey(String name,long timeout) throws InterruptedException {
  try {
    MasterOp op=new MasterOp(ClusterOperation.BLOCKING_GENERATE_KEY,name,timeout);
    op.request.setLongRequest();
    op.initOp();
    return (Long)op.getResultAsObject();
  }
 catch (  Exception e) {
    if (e instanceof RuntimeInterruptedException) {
      throw new InterruptedException();
    }
  }
  return -1;
}

Fixed version (ground truth):
public long generateKey(String name,long timeout) throws InterruptedException {
  try {
    MasterOp op=new MasterOp(ClusterOperation.BLOCKING_GENERATE_KEY,name,timeout);
    op.request.setLongRequest();
    op.request.txnId=ThreadContext.get().getThreadId();
    op.initOp();
    return (Long)op.getResultAsObject();
  }
 catch (  Exception e) {
    if (e instanceof RuntimeInterruptedException) {
      throw new InterruptedException();
    }
  }
  return -1;
}
Program: 49959
Project: 49959
Buggy source:
public void connectionRemoved(Connection connection){
  LifecycleServiceImpl lifecycleService=(LifecycleServiceImpl)node.factory.getLifecycleService();
  if (connection.equals(this.conn) && !lifecycleService.paused.get()) {
    removeLocks();
    rollbackTransactions();
    removeEntryListeners();
    removeEntryListenersWithKey();
    removeMessageListeners();
  }
}

Fixed version (ground truth):
public void connectionRemoved(Connection connection){
  LifecycleServiceImpl lifecycleService=(LifecycleServiceImpl)node.factory.getLifecycleService();
  if (connection.equals(this.conn) && !lifecycleService.paused.get()) {
    removeLocks();
    rollbackTransactions();
    removeEntryListeners();
    removeEntryListenersWithKey();
    removeMessageListeners();
    interruptRunningOperations();
  }
}
Program: 49960
Project: 49960
Buggy source:
@Override public void doRun(){
  ThreadContext.get().setCallContext(callContext);
  if (clientOperationHandler != null) {
    try {
      clientOperationHandler.handle(node,packet);
    }
 catch (    Throwable e) {
      if (node.isActive()) {
        throw (RuntimeException)e;
      }
    }
  }
 else {
    if (node.isActive()) {
      throw new RuntimeException("String_Node_Str" + packet.operation);
    }
  }
}

Fixed version (ground truth):
@Override public void doRun(){
  runningThread=Thread.currentThread();
  ThreadContext.get().setCallContext(callContext);
  if (clientOperationHandler != null) {
    try {
      clientOperationHandler.handle(node,packet);
      node.clientService.getClientEndpoint(packet.conn).removeRequest(this);
    }
 catch (    Throwable e) {
      e.printStackTrace();
      if (node.isActive()) {
        throw (RuntimeException)e;
      }
    }
  }
 else {
    if (node.isActive()) {
      throw new RuntimeException("String_Node_Str" + packet.operation);
    }
  }
}
Program: 49961
Project: 49961
Buggy source:
public void run(){
  try {
    Thread.sleep(3000);
    takeThread.interrupt();
  }
 catch (  InterruptedException e) {
    fail();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    q.take();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 49962
Project: 49962
Buggy source:
public byte[] get(String key){
  String mapName="String_Node_Str";
  int index=key.indexOf(':');
  if (index != -1) {
    mapName=key.substring(0,index);
    key=key.substring(index + 1);
  }
  Object value=hazelcast.getMap(mapName).get(key);
  if (value != null && value instanceof RestValue) {
    RestValue restValue=(RestValue)value;
    return restValue.getValue();
  }
 else {
    return (byte[])value;
  }
}

Fixed version (ground truth):
public Object get(String mapName,String key){
  return hazelcast.getMap(mapName).get(key);
}
Program: 49963
Project: 49963
Buggy source:
public void handle(DeleteCommand command){
  String key=command.getKey();
  String mapName="String_Node_Str";
  int index=key.indexOf(':');
  if (index != -1) {
    mapName=key.substring(0,index);
    key=key.substring(index + 1);
  }
  command.setResponse(DELETED);
  if (command.shouldReply()) {
    textCommandService.sendResponse(command);
  }
  textCommandService.incrementDeleteCount();
  textCommandService.delete(mapName,key);
}

Fixed version (ground truth):
public void handle(DeleteCommand command){
  String key=null;
  try {
    key=URLDecoder.decode(command.getKey(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  String mapName="String_Node_Str";
  int index=key.indexOf(':');
  if (index != -1) {
    mapName=key.substring(0,index);
    key=key.substring(index + 1);
  }
  command.setResponse(DELETED);
  if (command.shouldReply()) {
    textCommandService.sendResponse(command);
  }
  textCommandService.incrementDeleteCount();
  textCommandService.delete(mapName,key);
}
Program: 49964
Project: 49964
Buggy source:
public void handle(GetCommand getCommand){
  String key=getCommand.getKey();
  String mapName="String_Node_Str";
  int index=key.indexOf(':');
  if (index != -1) {
    mapName=key.substring(0,index);
    key=key.substring(index + 1);
  }
  Object value=textCommandService.get(mapName,key);
  MemcacheEntry entry=null;
  if (value != null) {
    if (value instanceof MemcacheEntry) {
      entry=(MemcacheEntry)value;
    }
 else {
      try {
        entry=new MemcacheEntry(key,IOUtil.serializeToBytes(value),0);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  textCommandService.incrementGetCount();
  if (entry != null) {
    textCommandService.incrementHitCount();
  }
  getCommand.setValue(entry,single);
  textCommandService.sendResponse(getCommand);
}

Fixed version (ground truth):
public void handle(GetCommand getCommand){
  String key=null;
  try {
    key=URLDecoder.decode(getCommand.getKey(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  String mapName="String_Node_Str";
  int index=key.indexOf(':');
  if (index != -1) {
    mapName=key.substring(0,index);
    key=key.substring(index + 1);
  }
  Object value=textCommandService.get(mapName,key);
  MemcacheEntry entry=null;
  if (value != null) {
    if (value instanceof MemcacheEntry) {
      entry=(MemcacheEntry)value;
    }
 else {
      try {
        entry=new MemcacheEntry(getCommand.getKey(),IOUtil.serializeToBytes(value),0);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  textCommandService.incrementGetCount();
  if (entry != null) {
    textCommandService.incrementHitCount();
  }
  getCommand.setValue(entry,single);
  textCommandService.sendResponse(getCommand);
}
Program: 49966
Project: 49966
Buggy source:
public boolean writeTo(ByteBuffer bb){
  while (bb.hasRemaining() && response.hasRemaining()) {
    bb.put(response.get());
  }
  return !response.hasRemaining();
}

Fixed version (ground truth):
public boolean writeTo(ByteBuffer bb){
  IOUtil.copyToHeapBuffer(response,bb);
  return !response.hasRemaining();
}
Program: 49967
Project: 49967
Buggy source:
public void setResponse(byte[] value){
  this.response=ByteBuffer.wrap(value);
}

Fixed version (ground truth):
/** 
 * HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-TextCommandType: text/html Content-Length: 1354
 * @param contentType
 * @param value
 */
public void setResponse(byte[] contentType,byte[] value){
  int valueSize=(value == null) ? 0 : value.length;
  byte[] len=String.valueOf(valueSize).getBytes();
  int size=RES_200.length;
  if (contentType != null) {
    size+=CONTENT_TYPE.length;
    size+=contentType.length;
    size+=RETURN.length;
  }
  size+=CONTENT_LENGTH.length;
  size+=len.length;
  size+=RETURN.length;
  size+=RETURN.length;
  size+=valueSize;
  size+=RETURN.length;
  this.response=ByteBuffer.allocate(size);
  response.put(RES_200);
  if (contentType != null) {
    response.put(CONTENT_TYPE);
    response.put(contentType);
    response.put(RETURN);
  }
  response.put(CONTENT_LENGTH);
  response.put(len);
  response.put(RETURN);
  response.put(RETURN);
  if (value != null) {
    response.put(value);
  }
  response.put(RETURN);
  response.flip();
}
Program: 49968
Project: 49968
Buggy source:
public void handle(HttpDeleteCommand command){
  String uri=command.getURI();
  if (uri.startsWith(URI_MAPS)) {
    int indexEnd=uri.indexOf('/',URI_MAPS.length());
    String mapName=uri.substring(URI_MAPS.length(),indexEnd);
    String key=uri.substring(indexEnd + 1);
    Object value=textCommandService.delete(mapName,key);
    command.send204();
  }
 else {
    command.send400();
  }
  textCommandService.sendResponse(command);
}

Fixed version (ground truth):
public void handle(HttpDeleteCommand command){
  String uri=command.getURI();
  if (uri.startsWith(URI_MAPS)) {
    int indexEnd=uri.indexOf('/',URI_MAPS.length());
    String mapName=uri.substring(URI_MAPS.length(),indexEnd);
    String key=uri.substring(indexEnd + 1);
    Object value=textCommandService.delete(mapName,key);
    command.send204();
  }
 else   if (uri.startsWith(URI_QUEUES)) {
    int indexEnd=uri.indexOf('/',URI_QUEUES.length());
    String queueName=uri.substring(URI_QUEUES.length(),indexEnd);
    String secondStr=(uri.length() > (indexEnd + 1)) ? uri.substring(indexEnd + 1) : null;
    int seconds=(secondStr == null) ? 0 : Integer.parseInt(secondStr);
    Object value=textCommandService.poll(queueName,seconds);
    if (value == null) {
      command.send204();
    }
 else {
      if (value instanceof byte[]) {
        command.setResponse(null,(byte[])value);
      }
 else       if (value instanceof RestValue) {
        RestValue restValue=(RestValue)value;
        command.setResponse(restValue.getContentType(),restValue.getValue());
      }
 else       if (value instanceof String) {
        command.setResponse(HttpCommand.CONTENT_TYPE_PLAIN_TEXT,((String)value).getBytes());
      }
 else {
        command.setResponse(null,ThreadContext.get().toByteArray(value));
      }
    }
  }
 else {
    command.send400();
  }
  textCommandService.sendResponse(command);
}
Program: 49969
Project: 49969
Buggy source:
public void handle(HttpGetCommand command){
  String uri=command.getURI();
  if (uri.startsWith(URI_MAPS)) {
    int indexEnd=uri.indexOf('/',URI_MAPS.length());
    String mapName=uri.substring(URI_MAPS.length(),indexEnd);
    String key=uri.substring(indexEnd + 1);
    Object value=textCommandService.get(mapName,key);
    if (value == null) {
      command.send204();
    }
 else {
      if (value instanceof byte[]) {
        command.setResponse(null,(byte[])value);
      }
 else       if (value instanceof RestValue) {
        RestValue restValue=(RestValue)value;
        command.setResponse(restValue.getContentType(),restValue.getValue());
      }
 else {
        command.setResponse(ThreadContext.get().toByteArray(value));
      }
    }
  }
 else   if (uri.startsWith(URI_CLUSTER)) {
    Node node=textCommandService.getNode();
    StringBuilder res=new StringBuilder(node.getClusterImpl().toString());
    res.append("String_Node_Str");
    ConnectionManager connectionManager=node.getConnectionManager();
    res.append("String_Node_Str" + connectionManager.getCurrentClientConnections());
    res.append("String_Node_Str");
    res.append("String_Node_Str" + connectionManager.getAllTextConnections());
    res.append("String_Node_Str");
    command.setResponse(null,res.toString().getBytes());
  }
 else {
    command.send400();
  }
  textCommandService.sendResponse(command);
}

Fixed version (ground truth):
public void handle(HttpGetCommand command){
  String uri=command.getURI();
  if (uri.startsWith(URI_MAPS)) {
    int indexEnd=uri.indexOf('/',URI_MAPS.length());
    String mapName=uri.substring(URI_MAPS.length(),indexEnd);
    String key=uri.substring(indexEnd + 1);
    Object value=textCommandService.get(mapName,key);
    if (value == null) {
      command.send204();
    }
 else {
      if (value instanceof byte[]) {
        command.setResponse(null,(byte[])value);
      }
 else       if (value instanceof RestValue) {
        RestValue restValue=(RestValue)value;
        command.setResponse(restValue.getContentType(),restValue.getValue());
      }
 else       if (value instanceof String) {
        command.setResponse(HttpCommand.CONTENT_TYPE_PLAIN_TEXT,((String)value).getBytes());
      }
 else {
        command.setResponse(ThreadContext.get().toByteArray(value));
      }
    }
  }
 else   if (uri.startsWith(URI_CLUSTER)) {
    Node node=textCommandService.getNode();
    StringBuilder res=new StringBuilder(node.getClusterImpl().toString());
    res.append("String_Node_Str");
    ConnectionManager connectionManager=node.getConnectionManager();
    res.append("String_Node_Str" + connectionManager.getCurrentClientConnections());
    res.append("String_Node_Str");
    res.append("String_Node_Str" + connectionManager.getAllTextConnections());
    res.append("String_Node_Str");
    command.setResponse(null,res.toString().getBytes());
  }
 else {
    command.send400();
  }
  textCommandService.sendResponse(command);
}
Program: 49970
Project: 49970
Buggy source:
public MulticastService(Node node,MulticastSocket multicastSocket) throws Exception {
  this.node=node;
  logger=node.getLogger(MulticastService.class.getName());
  Config config=node.getConfig();
  this.multicastSocket=multicastSocket;
  int bufferSize=1024 * 1024;
  this.datagramPacketReceive=new DatagramPacket(new byte[bufferSize],bufferSize);
  this.datagramPacketSend=new DatagramPacket(new byte[bufferSize],bufferSize,InetAddress.getByName(config.getNetworkConfig().getJoin().getMulticastConfig().getMulticastGroup()),config.getNetworkConfig().getJoin().getMulticastConfig().getMulticastPort());
  running=true;
}

Fixed version (ground truth):
public MulticastService(Node node,MulticastSocket multicastSocket) throws Exception {
  this.node=node;
  logger=node.getLogger(MulticastService.class.getName());
  Config config=node.getConfig();
  this.multicastSocket=multicastSocket;
  int bufferSize=64 * 1024;
  this.datagramPacketReceive=new DatagramPacket(new byte[bufferSize],bufferSize);
  this.datagramPacketSend=new DatagramPacket(new byte[bufferSize],bufferSize,InetAddress.getByName(config.getNetworkConfig().getJoin().getMulticastConfig().getMulticastGroup()),config.getNetworkConfig().getJoin().getMulticastConfig().getMulticastPort());
  running=true;
}
Program: 49971
Project: 49971
Buggy source:
public void send(JoinInfo joinInfo){
synchronized (sendLock) {
    try {
      joinInfo.writeToPacket(datagramPacketSend);
      multicastSocket.send(datagramPacketSend);
    }
 catch (    IOException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
public void send(JoinInfo joinInfo){
synchronized (sendLock) {
    try {
      joinInfo.writeToPacket(datagramPacketSend);
      multicastSocket.send(datagramPacketSend);
    }
 catch (    IOException e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
}
Program: 49972
Project: 49972
Buggy source:
public boolean cancel(boolean mayInterruptIfRunning){
  return false;
}

Fixed version (ground truth):
public boolean cancel(boolean mayInterruptIfRunning){
  cancelled=(Boolean)proxyHelper.doOp(ClusterOperation.CANCEL_EXECUTION,call.getId(),mayInterruptIfRunning);
  return cancelled;
}
Program: 49973
Project: 49973
Buggy source:
public void get(long timeout,TimeUnit unit) throws InterruptedException, ExecutionException {
  try {
    Object response=call.getResponse(timeout,unit);
    handle(response);
  }
 catch (  Throwable e) {
    handle(e);
  }
}

Fixed version (ground truth):
public void get(long timeout,TimeUnit unit) throws InterruptedException, ExecutionException {
  if (cancelled)   throw new CancellationException();
  try {
    Object response=call.getResponse(timeout,unit);
    handle(response);
  }
 catch (  Throwable e) {
    handle(e);
  }
}
Program: 49974
Project: 49974
Buggy source:
public void run(){
}

Fixed version (ground truth):
public void run(){
  try {
    System.out.println("String_Node_Str");
    Thread.sleep(1000);
    System.out.println("String_Node_Str");
    getHazelcastInstance().getMap("String_Node_Str").put(1,false);
  }
 catch (  InterruptedException e) {
    System.out.println("String_Node_Str");
    getHazelcastInstance().getMap("String_Node_Str").put(1,true);
  }
}
Program: 49976
Project: 49976
Buggy source:
public void done(Future future){
  Object result;
  try {
    result=future.get();
    packet.setValue(toData(result));
  }
 catch (  InterruptedException e) {
    return;
  }
catch (  ExecutionException e) {
    packet.setValue(toData(e));
  }
  sendResponse(packet);
}

Fixed version (ground truth):
public void done(Future future){
  Object result;
  try {
    clientEndpoint.removeTask(packet.callId);
    result=future.get();
    packet.setValue(toData(result));
  }
 catch (  InterruptedException e) {
    return;
  }
catch (  CancellationException e) {
    packet.setValue(toData(e));
  }
catch (  ExecutionException e) {
    packet.setValue(toData(e));
  }
  sendResponse(packet);
}
Program: 49977
Project: 49977
Buggy source:
public void lockMap(Request request){
  if (request.operation == CONCURRENT_MAP_LOCK_MAP) {
    if (lockEntireMap == null) {
      lockEntireMap=new DistributedLock();
    }
    lockEntireMap.lock(request.lockAddress,request.lockThreadId);
    request.clearForResponse();
    request.response=Boolean.TRUE;
  }
 else   if (request.operation == CONCURRENT_MAP_UNLOCK_MAP) {
    if (lockEntireMap != null) {
      request.response=lockEntireMap.unlock(request.lockAddress,request.lockThreadId);
    }
 else {
      request.response=Boolean.TRUE;
    }
  }
}

Fixed version (ground truth):
public void lockMap(Request request){
  if (request.operation == CONCURRENT_MAP_LOCK_MAP) {
    if (lockEntireMap == null) {
      lockEntireMap=new DistributedLock();
    }
    if (!lockEntireMap.isLockedBy(request.lockAddress,request.lockThreadId)) {
      lockEntireMap.lock(request.lockAddress,request.lockThreadId);
    }
    request.clearForResponse();
    request.response=Boolean.TRUE;
  }
 else   if (request.operation == CONCURRENT_MAP_UNLOCK_MAP) {
    if (lockEntireMap != null) {
      request.response=lockEntireMap.unlock(request.lockAddress,request.lockThreadId);
    }
 else {
      request.response=Boolean.TRUE;
    }
  }
}
Program: 49978
Project: 49978
Buggy source:
final boolean isNotLocked(Request request){
  return (lockEntireMap == null || !lockEntireMap.isLocked() || lockEntireMap.isLockedBy(request.lockAddress,request.lockThreadId));
}

Fixed version (ground truth):
final boolean isNotLocked(Request request){
  boolean result=(lockEntireMap == null || !lockEntireMap.isLocked() || lockEntireMap.isLockedBy(request.lockAddress,request.lockThreadId));
  if (!result) {
    System.out.println(thisAddress + "String_Node_Str" + request.caller);
    System.out.println(lockEntireMap + "String_Node_Str" + request.operation);
  }
  return result;
}
Program: 49979
Project: 49979
Buggy source:
/** 
 * MultiMap and List have to use versioned backup because each key can have multiple values and we don't want to miss backing up each one.
 * @param req
 * @return
 */
private boolean backupMultiValue(Request req){
  Record record=getRecord(req);
  if (record != null) {
    record.setActive();
    if (req.version > record.getVersion() + 1) {
      Request reqCopy=req.hardCopy();
      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):
/** 
 * MultiMap and List have to use versioned backup because each key can have multiple values and we don't want to miss backing up each one.
 * @param req
 * @return
 */
private boolean backupMultiValue(Request req){
  Record record=getRecord(req);
  if (record != null) {
    record.setActive();
    if (req.version > record.getVersion() + 1) {
      Request reqCopy=req.hardCopy();
      record.addBackupOp(new VersionedBackupOp(this,reqCopy));
      return true;
    }
  }
  doBackup(req);
  if (record != null) {
    record.setVersion(req.version);
    record.runBackupOps();
  }
  return true;
}
Program: 49980
Project: 49980
Buggy source:
public void run(){
  long now=System.currentTimeMillis();
  if (now > nextMigrationMillis) {
    if (migrationStartTime != 0) {
      logger.log(Level.WARNING,"String_Node_Str" + ((now - migrationStartTime) / 1000) + "String_Node_Str");
      for (      Block block : blocks) {
        logger.log(Level.WARNING,block == null ? "String_Node_Str" : block.toString());
      }
    }
    nextMigrationMillis=now + MIGRATION_INTERVAL_MILLIS;
    if (!concurrentMapManager.isMaster())     return;
    if (concurrentMapManager.getMembers().size() < 2)     return;
    if (now > timeToInitiateMigration) {
      initiateMigration();
    }
  }
}

Fixed version (ground truth):
public void run(){
  long now=System.currentTimeMillis();
  if (now > nextMigrationMillis) {
    if (migrationStartTime != 0) {
      for (      Block block : blocks) {
        if (block != null && block.isMigrating()) {
          long seconds=((now - migrationStartTime) / 1000);
          String msg=block.toString() + "String_Node_Str" + seconds+ "String_Node_Str";
          logger.log(Level.WARNING,msg);
        }
      }
    }
    nextMigrationMillis=now + MIGRATION_INTERVAL_MILLIS;
    if (!concurrentMapManager.isMaster())     return;
    if (concurrentMapManager.getMembers().size() < 2)     return;
    if (now > timeToInitiateMigration) {
      initiateMigration();
    }
  }
}
Program: 49981
Project: 49981
Buggy source:
void migrateBlock(final Block blockInfo){
  Block blockReal=blocks[blockInfo.getBlockId()];
  if (!thisAddress.equals(blockInfo.getOwner())) {
    throw new RuntimeException(thisAddress + "String_Node_Str" + blockInfo);
  }
  if (!blockInfo.isMigrating()) {
    throw new RuntimeException(thisAddress + "String_Node_Str" + blockInfo);
  }
  if (blockInfo.getOwner().equals(blockInfo.getMigrationAddress())) {
    throw new RuntimeException(thisAddress + "String_Node_Str" + blockInfo);
  }
  if (!node.isActive() || node.factory.restarted) {
    return;
  }
  if (concurrentMapManager.isSuperClient()) {
    return;
  }
  if (blockReal.isMigrationStarted())   return;
  blockReal.setMigrationStarted(true);
  blockReal.setOwner(blockInfo.getOwner());
  blockReal.setMigrationAddress(blockInfo.getMigrationAddress());
  logger.log(Level.FINEST,"String_Node_Str" + blockInfo);
  List<Record> lsRecordsToMigrate=new ArrayList<Record>(1000);
  Collection<CMap> cmaps=concurrentMapManager.maps.values();
  for (  final CMap cmap : cmaps) {
    for (    Record rec : cmap.mapRecords.values()) {
      if (rec.isActive() && concurrentMapManager.isOwned(rec)) {
        if (rec.getKeyData() == null || rec.getKeyData().size() == 0) {
          throw new RuntimeException("String_Node_Str" + rec.getKeyData());
        }
        if (rec.getBlockId() == blockInfo.getBlockId()) {
          cmap.onMigrate(rec);
          Record recordCopy=rec.copy();
          lsRecordsToMigrate.add(recordCopy);
          cmap.markAsEvicted(rec);
        }
      }
    }
  }
  logger.log(Level.FINEST,"String_Node_Str" + lsRecordsToMigrate.size() + "String_Node_Str"+ blockInfo);
  final CountDownLatch latch=new CountDownLatch(lsRecordsToMigrate.size());
  for (  final Record rec : lsRecordsToMigrate) {
    final CMap cmap=concurrentMapManager.getMap(rec.getName());
    parallelExecutorMigration.execute(new FallThroughRunnable(){
      public void doRun(){
        try {
          concurrentMapManager.migrateRecord(cmap,rec);
        }
  finally {
          latch.countDown();
        }
      }
    }
);
  }
  parallelExecutorMigration.execute(new FallThroughRunnable(){
    public void doRun(){
      try {
        logger.log(Level.FINEST,"String_Node_Str" + blockInfo + "String_Node_Str");
        latch.await(10,TimeUnit.SECONDS);
        if (MIGRATION_COMPLETE_WAIT_SECONDS > 0) {
          Thread.sleep(MIGRATION_COMPLETE_WAIT_SECONDS * 1000);
        }
      }
 catch (      InterruptedException ignored) {
      }
 finally {
        concurrentMapManager.enqueueAndReturn(new Processable(){
          public void process(){
            blockInfo.setOwner(blockInfo.getMigrationAddress());
            blockInfo.setMigrationAddress(null);
            completeMigration(blockInfo.getBlockId());
            sendCompletionInfo(blockInfo);
          }
        }
);
      }
    }
  }
);
}

Fixed version (ground truth):
void migrateBlock(final Block blockInfo){
  List<Record> lsRecordsToMigrate=prepareMigratingRecords(blockInfo);
  if (lsRecordsToMigrate == null)   return;
  migrateRecords(blockInfo,lsRecordsToMigrate);
}
Program: 49982
Project: 49982
Buggy source:
void handleBlocks(Blocks blockOwners){
  for (  Block block : blockOwners.lsBlocks) {
    Block blockReal=getOrCreateBlock(block.getBlockId());
    boolean same=sameBlocks(block,blockReal);
    blockReal.setOwner(block.getOwner());
    blockReal.setMigrationAddress(block.getMigrationAddress());
    if (thisAddress.equals(blockReal.getOwner()) && blockReal.isMigrating()) {
      startMigration(new Block(block));
    }
 else     if (!same && block.getOwner() != null) {
      boolean started=blockReal.isMigrating();
      if (started) {
        fireMigrationEvent(started,new Block(block));
      }
 else {
        fireMigrationEvent(started,new Block(block.getBlockId(),null,block.getOwner()));
      }
    }
    if (!same) {
      invalidateBlocksHash();
    }
  }
}

Fixed version (ground truth):
void handleBlocks(Blocks blockOwners){
  for (  Block block : blockOwners.lsBlocks) {
    Block blockReal=getOrCreateBlock(block.getBlockId());
    boolean same=sameBlocks(block,blockReal);
    blockReal.setOwner(block.getOwner());
    blockReal.setMigrationAddress(block.getMigrationAddress());
    if (thisAddress.equals(blockReal.getOwner()) && blockReal.isMigrating()) {
      fireMigrationEventAndMigrate(new Block(block));
    }
 else     if (!same && block.getOwner() != null) {
      boolean started=blockReal.isMigrating();
      if (started) {
        fireMigrationEvent(started,new Block(block));
      }
 else {
        fireMigrationEvent(started,new Block(block.getBlockId(),null,block.getOwner()));
      }
    }
    if (!same) {
      invalidateBlocksHash();
    }
  }
}
Program: 49983
Project: 49983
Buggy source:
final void handleSocketException(Throwable e){
  if (e instanceof OutOfMemoryError) {
    node.onOutOfMemory((OutOfMemoryError)e);
  }
  if (sk != null) {
    sk.cancel();
  }
  connection.close();
  StringBuilder sb=new StringBuilder();
  sb.append(Thread.currentThread().getName());
  sb.append("String_Node_Str");
  sb.append(connection.getEndPoint());
  sb.append("String_Node_Str").append(e);
  if (e instanceof EOFException) {
    logger.log(Level.WARNING,sb.toString());
  }
 else {
    logger.log(Level.WARNING,sb.toString(),e);
  }
}

Fixed version (ground truth):
final void handleSocketException(Throwable e){
  if (e instanceof OutOfMemoryError) {
    node.onOutOfMemory((OutOfMemoryError)e);
  }
  if (sk != null) {
    sk.cancel();
  }
  connection.close();
  StringBuilder sb=new StringBuilder();
  sb.append(Thread.currentThread().getName());
  sb.append("String_Node_Str");
  sb.append(connection.getEndPoint());
  sb.append("String_Node_Str").append(e);
  if (e instanceof IOException) {
    logger.log(Level.WARNING,sb.toString());
  }
 else {
    logger.log(Level.WARNING,sb.toString(),e);
  }
}
Program: 49985
Project: 49985
Buggy source:
private void postJoin(){
  if (!isMaster()) {
    Set<Member> members=null;
    boolean allConnected=false;
    int checkCount=0;
    while (checkCount++ < 100 && !allConnected) {
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException ignored) {
      }
      members=clusterImpl.getMembers();
      allConnected=true;
      for (      Member member : members) {
        MemberImpl memberImpl=(MemberImpl)member;
        if (!memberImpl.localMember() && connectionManager.getConnection(memberImpl.getAddress()) == null) {
          allConnected=false;
        }
      }
    }
    if (!allConnected) {
      logger.log(Level.WARNING,"String_Node_Str" + checkCount + "String_Node_Str");
      logger.log(Level.WARNING,"String_Node_Str");
      try {
        Thread.sleep(10000);
      }
 catch (      InterruptedException e) {
        shutdown();
      }
      rejoin();
      return;
    }
 else {
      clusterManager.finalizeJoin();
    }
  }
  clusterManager.enqueueAndWait(new Processable(){
    public void process(){
      if (baseVariables.lsMembers.size() == 1) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str");
        sb.append(clusterManager);
        logger.log(Level.INFO,sb.toString());
      }
    }
  }
,5);
}

Fixed version (ground truth):
private void postJoin(){
  if (!isMaster()) {
    boolean allConnected=false;
    int checkCount=0;
    while (checkCount++ < 100 && !allConnected) {
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException ignored) {
      }
      Set<Member> members=clusterImpl.getMembers();
      allConnected=true;
      for (      Member member : members) {
        MemberImpl memberImpl=(MemberImpl)member;
        if (!memberImpl.localMember() && connectionManager.getConnection(memberImpl.getAddress()) == null) {
          allConnected=false;
        }
      }
    }
    if (!allConnected) {
      logger.log(Level.WARNING,"String_Node_Str" + checkCount + "String_Node_Str");
      logger.log(Level.WARNING,"String_Node_Str");
      try {
        Thread.sleep(10000);
      }
 catch (      InterruptedException e) {
        shutdown();
      }
      rejoin();
      return;
    }
 else {
      clusterManager.finalizeJoin();
    }
  }
  clusterManager.enqueueAndWait(new Processable(){
    public void process(){
      if (baseVariables.lsMembers.size() == 1) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str");
        sb.append(clusterManager);
        logger.log(Level.INFO,sb.toString());
      }
    }
  }
,5);
}
Program: 49986
Project: 49986
Buggy source:
public void putAll(final Map<? extends K,? extends V> map){
  List<Future> lsFutures=new ArrayList<Future>(map.size());
  for (  final K key : map.keySet()) {
    final V value=map.get(key);
    lsFutures.add(putAsync(key,value));
  }
  for (  Future future : lsFutures) {
    try {
      future.get();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void putAll(final Map<? extends K,? extends V> map){
  Pairs pairs=new Pairs(map.size());
  for (  final K key : map.keySet()) {
    final V value=map.get(key);
    pairs.addKeyValue(new KeyValue(toData(key),toData(value)));
  }
  proxyHelper.doOp(ClusterOperation.CONCURRENT_MAP_PUT_ALL,null,pairs);
}