nus-yam/ex-repair huggingface dataset:
Program: 49895
Project: 49895
Buggy source:
@Test @Ignore public void testMapInstanceDestroy() throws Exception {
  IMap<String,String> map=getHazelcastClient().getMap("String_Node_Str");
  Thread.sleep(1000);
  Collection<Instance> instances=getHazelcastClient().getInstances();
  boolean found=false;
  for (  Instance instance : instances) {
    if (instance.getInstanceType() == Instance.InstanceType.MAP) {
      IMap imap=(IMap)instance;
      if (imap.getName().equals("String_Node_Str")) {
        found=true;
      }
    }
  }
  assertTrue(found);
  map.destroy();
  Thread.sleep(1000);
  found=false;
  instances=getHazelcastClient().getInstances();
  for (  Instance instance : instances) {
    if (instance.getInstanceType() == Instance.InstanceType.MAP) {
      IMap imap=(IMap)instance;
      if (imap.getName().equals("String_Node_Str")) {
        found=true;
      }
    }
  }
  assertFalse(found);
}

Fixed version (ground truth):
@Test @Ignore public void testMapInstanceDestroy() throws Exception {
  IMap<String,String> map=getHazelcastClient().getMap("String_Node_Str");
  Thread.sleep(1000);
  Collection<Instance> instances=getHazelcastClient().getInstances();
  boolean found=false;
  for (  Instance instance : instances) {
    if (instance.getInstanceType().isMap()) {
      IMap imap=(IMap)instance;
      if (imap.getName().equals("String_Node_Str")) {
        found=true;
      }
    }
  }
  assertTrue(found);
  map.destroy();
  Thread.sleep(1000);
  found=false;
  instances=getHazelcastClient().getInstances();
  for (  Instance instance : instances) {
    if (instance.getInstanceType().isMap()) {
      IMap imap=(IMap)instance;
      if (imap.getName().equals("String_Node_Str")) {
        found=true;
      }
    }
  }
  assertFalse(found);
}
Program: 49896
Project: 49896
Buggy source:
@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) {
      logger.log(Level.WARNING,e.getMessage(),e);
      if (node.isActive()) {
        throw (RuntimeException)e;
      }
    }
  }
 else {
    final String error="String_Node_Str" + packet.operation;
    logger.log(Level.WARNING,error);
    if (node.isActive()) {
      throw new RuntimeException(error);
    }
  }
}

Fixed version (ground truth):
@Override public void doRun(){
  runningThread=Thread.currentThread();
  ThreadContext.get().setCallContext(callContext);
  try {
    clientOperationHandler.handle(node,packet);
    node.clientService.getClientEndpoint(packet.conn).removeRequest(this);
    clientOperationHandler.postHandle(packet);
  }
 catch (  Throwable e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    if (node.isActive()) {
      throw (RuntimeException)e;
    }
  }
}
Program: 49897
Project: 49897
Buggy source:
public void connectionRemoved(final Connection connection){
  final ClientEndpoint clientEndpoint=mapClientEndpoints.remove(connection);
  if (clientEndpoint != null) {
    node.executorManager.executeNow(new FallThroughRunnable(){
      public void doRun(){
        clientEndpoint.connectionRemoved(connection);
      }
    }
);
  }
}

Fixed version (ground truth):
public void connectionRemoved(final Connection connection){
  final ClientEndpoint clientEndpoint=removeClientEndpoint(connection);
  if (clientEndpoint != null) {
    node.executorManager.executeNow(new FallThroughRunnable(){
      public void doRun(){
        clientEndpoint.connectionRemoved(connection);
      }
    }
);
  }
}
Program: 49898
Project: 49898
Buggy source:
private void postJoin(){
  if (!node.isMaster()) {
    boolean allConnected=false;
    int checkCount=0;
    if (node.joined()) {
      while (checkCount++ < 100 && !allConnected) {
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException ignored) {
        }
        Set<Member> members=node.getClusterImpl().getMembers();
        allConnected=true;
        for (        Member member : members) {
          MemberImpl memberImpl=(MemberImpl)member;
          if (!memberImpl.localMember() && node.connectionManager.getConnection(memberImpl.getAddress()) == null) {
            allConnected=false;
          }
        }
      }
    }
    if (!node.joined() || !allConnected) {
      logger.log(Level.WARNING,"String_Node_Str" + node.joined() + "String_Node_Str"+ allConnected+ "String_Node_Str"+ checkCount+ "String_Node_Str");
      logger.log(Level.WARNING,"String_Node_Str");
      try {
        Thread.sleep(10000);
      }
 catch (      InterruptedException e) {
        node.shutdown();
      }
      node.rejoin();
      return;
    }
 else {
      node.clusterManager.finalizeJoin();
    }
  }
  node.clusterManager.enqueueAndWait(new Processable(){
    public void process(){
      if (node.baseVariables.lsMembers.size() == 1) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str");
        sb.append(node.clusterManager);
        logger.log(Level.INFO,sb.toString());
      }
    }
  }
,5);
}

Fixed version (ground truth):
private void postJoin(){
  if (tryCount.incrementAndGet() == 5) {
    node.setAsMaster();
  }
  if (!node.isMaster()) {
    boolean allConnected=false;
    int checkCount=0;
    if (node.joined()) {
      while (checkCount++ < 100 && !allConnected) {
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException ignored) {
        }
        Set<Member> members=node.getClusterImpl().getMembers();
        allConnected=true;
        for (        Member member : members) {
          MemberImpl memberImpl=(MemberImpl)member;
          if (!memberImpl.localMember() && node.connectionManager.getConnection(memberImpl.getAddress()) == null) {
            allConnected=false;
          }
        }
      }
    }
    if (!node.joined() || !allConnected) {
      logger.log(Level.WARNING,"String_Node_Str" + node.joined() + "String_Node_Str"+ allConnected+ "String_Node_Str"+ checkCount+ "String_Node_Str");
      logger.log(Level.WARNING,"String_Node_Str");
      try {
        Thread.sleep(10000);
      }
 catch (      InterruptedException e) {
        node.shutdown();
      }
      node.rejoin();
      return;
    }
 else {
      node.clusterManager.finalizeJoin();
    }
  }
  node.clusterManager.enqueueAndWait(new Processable(){
    public void process(){
      if (node.baseVariables.lsMembers.size() == 1) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str");
        sb.append(node.clusterManager);
        logger.log(Level.INFO,sb.toString());
      }
    }
  }
,5);
}
Program: 49900
Project: 49900
Buggy source:
void storeProceed(CMap cmap,Request request){
  if (cmap.store != null && cmap.writeDelayMillis == 0) {
    storeExecutor.execute(new PutStorer(cmap,request),request.key.hashCode());
  }
 else {
    doOperation(request);
    returnResponse(request);
  }
}

Fixed version (ground truth):
void storeProceed(CMap cmap,Request request){
  if (cmap.store != null && cmap.writeDelayMillis == 0 && cmap.isApplicable(request.operation,request,System.currentTimeMillis())) {
    storeExecutor.execute(new PutStorer(cmap,request),request.key.hashCode());
  }
 else {
    doOperation(request);
    returnResponse(request);
  }
}
Program: 49901
Project: 49901
Buggy source:
protected void backup(ClusterOperation operation){
  if (thisAddress.equals(target) && (operation == CONCURRENT_MAP_LOCK || operation == CONCURRENT_MAP_UNLOCK || operation == ClusterOperation.SEMAPHORE_ACQUIRE || operation == ClusterOperation.SEMAPHORE_RELEASE || operation == SEMAPHORE_DRAIN_PERMITS || operation == ClusterOperation.SEMAPHORE_REDUCE_PERMITS)) {
    return;
  }
  if (backupCount > 0) {
    for (int i=0; i < backupCount; i++) {
      int distance=i + 1;
      MBackup backupOp=backupOps[i];
      if (backupOp == null) {
        backupOp=new MBackup();
        backupOps[i]=backupOp;
      }
      if (request.key == null || request.key.size() == 0) {
        throw new RuntimeException("String_Node_Str" + request.key);
      }
      backupOp.sendBackup(operation,target,distance,request);
    }
    for (int i=0; i < backupCount; i++) {
      MBackup backupOp=backupOps[i];
      backupOp.getResultAsBoolean();
    }
  }
}

Fixed version (ground truth):
protected void backup(ClusterOperation operation){
  if (thisAddress.equals(target) && (operation == CONCURRENT_MAP_LOCK || operation == CONCURRENT_MAP_UNLOCK || operation == SEMAPHORE_ACQUIRE || operation == SEMAPHORE_RELEASE || operation == SEMAPHORE_DRAIN_PERMITS || operation == SEMAPHORE_REDUCE_PERMITS)) {
    return;
  }
  if (backupCount > 0) {
    for (int i=0; i < backupCount; i++) {
      int distance=i + 1;
      MBackup backupOp=backupOps[i];
      if (backupOp == null) {
        backupOp=new MBackup();
        backupOps[i]=backupOp;
      }
      if (request.key == null || request.key.size() == 0) {
        throw new RuntimeException("String_Node_Str" + request.key);
      }
      backupOp.sendBackup(operation,target,distance,request);
    }
    for (int i=0; i < backupCount; i++) {
      MBackup backupOp=backupOps[i];
      backupOp.getResultAsBoolean();
    }
  }
}
Program: 49902
Project: 49902
Buggy source:
public void shutdown(){
  for (  CMap cmap : maps.values()) {
    try {
      flush(cmap.name);
    }
 catch (    Throwable e) {
      if (node.isActive()) {
        logger.log(Level.SEVERE,e.getMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
public void shutdown(){
  for (  CMap cmap : maps.values()) {
    try {
      flush(cmap.name);
      cmap.reset();
    }
 catch (    Throwable e) {
      if (node.isActive()) {
        logger.log(Level.SEVERE,e.getMessage(),e);
      }
    }
  }
}
Program: 49903
Project: 49903
Buggy source:
public void destroy(){
  if (impl instanceof MapLoaderLifecycleSupport) {
    ((MapLoaderLifecycleSupport)impl).destroy();
  }
}

Fixed version (ground truth):
public void destroy(){
  if (shouldInitialize && initialized) {
synchronized (initLock) {
      if (initialized) {
        ((MapLoaderLifecycleSupport)impl).destroy();
        initialized=false;
      }
    }
  }
}
Program: 49904
Project: 49904
Buggy source:
@Test public void testOneMemberFlushOnShutdown() throws Exception {
  TestMapStore testMapStore=new TestMapStore(1,1,1);
  testMapStore.setLoadAllKeys(false);
  Config config=newConfig(testMapStore,200);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  IMap map1=h1.getMap("String_Node_Str");
  assertEquals(0,map1.size());
  for (int i=0; i < 100; i++) {
    map1.put(i,i);
  }
  assertEquals(100,map1.size());
  assertEquals(0,testMapStore.getStore().size());
  h1.getLifecycleService().shutdown();
  assertEquals(100,testMapStore.getStore().size());
}

Fixed version (ground truth):
@Test public void testOneMemberFlushOnShutdown() throws Exception {
  TestMapStore testMapStore=new TestMapStore(1,1,1);
  testMapStore.setLoadAllKeys(false);
  Config config=newConfig(testMapStore,200);
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(config);
  IMap map1=h1.getMap("String_Node_Str");
  assertEquals(0,map1.size());
  for (int i=0; i < 100; i++) {
    map1.put(i,i);
  }
  assertEquals(100,map1.size());
  assertEquals(0,testMapStore.getStore().size());
  h1.getLifecycleService().shutdown();
  assertEquals(100,testMapStore.getStore().size());
  assertEquals(1,testMapStore.getDestroyCount());
}
Program: 49906
Project: 49906
Buggy source:
public boolean writeTo(ByteBuffer bb){
  if (value != null) {
    IOUtil.copyToHeapBuffer(value,bb);
  }
  if (lastOne != null) {
    IOUtil.copyToHeapBuffer(lastOne,bb);
  }
  return !(value != null && value.hasRemaining()) || (lastOne != null && lastOne.hasRemaining());
}

Fixed version (ground truth):
public boolean writeTo(ByteBuffer bb){
  if (value != null) {
    IOUtil.copyToHeapBuffer(value,bb);
  }
  if (lastOne != null) {
    IOUtil.copyToHeapBuffer(lastOne,bb);
  }
  return !((value != null && value.hasRemaining()) || (lastOne != null && lastOne.hasRemaining()));
}
Program: 49907
Project: 49907
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + key + '\''+ '}'+ super.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + key + "String_Node_Str"+ value+ '\''+ "String_Node_Str"+ super.toString();
}
Program: 49909
Project: 49909
Buggy source:
Object getValue(Object obj) throws Exception {
  obj=parent != null ? parent.getValue(obj) : obj;
  return obj != null ? field.get(obj) : null;
}

Fixed version (ground truth):
@Override Object getValue(Object obj) throws Exception {
  return obj;
}
Program: 49910
Project: 49910
Buggy source:
Class getReturnType(){
  return this.field.getType();
}

Fixed version (ground truth):
@Override Class getReturnType(){
  return this.object.getClass();
}
Program: 49911
Project: 49911
Buggy source:
public ConnectionManager(final HazelcastClient client,LifecycleServiceClientImpl lifecycleService,InetSocketAddress address){
  this.client=client;
  this.lifecycleService=lifecycleService;
  this.clusterMembers.add(address);
}

Fixed version (ground truth):
public ConnectionManager(final HazelcastClient client,LifecycleServiceClientImpl lifecycleService,InetSocketAddress address,long timeout){
  this.TIMEOUT=timeout;
  this.client=client;
  this.lifecycleService=lifecycleService;
  this.clusterMembers.add(address);
  scheduleAHeartBeatThread();
}
Program: 49912
Project: 49912
Buggy source:
protected void customRun() throws InterruptedException {
  if (reconnection.get()) {
    Thread.sleep(50L);
    return;
  }
  try {
    boolean written=false;
    if (queue.size() > 0 || q.size() > 0) {
      queue.drainTo(q);
      Call call=q.poll();
      while (call != null) {
        writeCall(call);
        written=true;
        call=q.poll();
      }
    }
    try {
      if (written) {
        writer.flush(connection);
      }
    }
 catch (    IOException e) {
      clusterIsDown(connection);
    }
    Call call=queue.poll(12,TimeUnit.MILLISECONDS);
    if (call != null) {
      writeCall(call);
      try {
        writer.flush(connection);
      }
 catch (      IOException e) {
        clusterIsDown(connection);
      }
    }
    if (reconnectionCalls.size() > 0) {
      checkOnReconnect(call);
    }
  }
 catch (  Throwable e) {
    logger.log(Level.FINE,"String_Node_Str" + connection + "String_Node_Str"+ e.toString(),e);
  }
}

Fixed version (ground truth):
protected void customRun() throws InterruptedException {
  if (reconnection.get()) {
    Thread.sleep(50L);
    return;
  }
  try {
    boolean written=false;
    if (queue.size() > 0 || q.size() > 0) {
      queue.drainTo(q);
      Call call=q.poll();
      while (call != null) {
        writeCall(call);
        written=true;
        call=q.poll();
      }
    }
    try {
      if (written) {
        writer.flush(connection);
      }
    }
 catch (    IOException e) {
      clusterIsDown(connection);
    }
    Call call=queue.poll(12,TimeUnit.MILLISECONDS);
    if (call != null) {
      writeCall(call);
      System.out.println("String_Node_Str" + call);
      lastSend=System.currentTimeMillis();
      try {
        writer.flush(connection);
      }
 catch (      IOException e) {
        clusterIsDown(connection);
      }
    }
    if (reconnectionCalls.size() > 0) {
      checkOnReconnect(call);
    }
  }
 catch (  Throwable e) {
    logger.log(Level.FINE,"String_Node_Str" + connection + "String_Node_Str"+ e.toString(),e);
  }
}
Program: 49915
Project: 49915
Buggy source:
public boolean putMulti(Request req){
  Record record=getRecord(req);
  boolean added=true;
  if (record == null) {
    record=toRecord(req);
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    Data value=req.value;
    updateIndexes(record);
    record.addValue(value);
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record.getKeyData(),null,value,record.getListeners(),req.caller);
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  req.clearForResponse();
  req.version=record.getVersion();
  return added;
}

Fixed version (ground truth):
public boolean putMulti(Request req){
  Record record=getRecord(req);
  boolean added=true;
  if (record == null) {
    record=toRecord(req);
  }
 else {
    if (!record.isActive()) {
      markAsActive(record);
    }
    if (record.containsValue(req.value)) {
      added=false;
    }
  }
  if (added) {
    Data value=req.value;
    updateIndexes(record);
    record.addValue(value);
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record.getKeyData(),null,value,record.getListeners(),req.caller);
  }
  if (req.txnId != -1) {
    unlock(record,req);
  }
  req.clearForResponse();
  req.version=record.getVersion();
  return added;
}
Program: 49916
Project: 49916
Buggy source:
public void onDisconnect(Record record,Address deadAddress){
  if (record == null || deadAddress == null)   return;
  List<ScheduledAction> lsScheduledActions=record.getScheduledActions();
  if (lsScheduledActions != null) {
    if (lsScheduledActions.size() > 0) {
      Iterator<ScheduledAction> it=lsScheduledActions.iterator();
      while (it.hasNext()) {
        ScheduledAction sa=it.next();
        if (deadAddress.equals(sa.getRequest().caller)) {
          node.clusterManager.deregisterScheduledAction(sa);
          sa.setValid(false);
          it.remove();
        }
      }
    }
  }
  if (record.getLockCount() > 0) {
    if (deadAddress.equals(record.getLockAddress())) {
      unlock(record);
    }
  }
  if (record.getValue() instanceof DistributedSemaphore) {
    DistributedSemaphore semaphore=(DistributedSemaphore)record.getValue();
    if (semaphore.hasPermits(deadAddress)) {
      semaphore.releaseAll(deadAddress);
    }
  }
}

Fixed version (ground truth):
public void onDisconnect(Record record,Address deadAddress){
  if (record == null || deadAddress == null)   return;
  List<ScheduledAction> lsScheduledActions=record.getScheduledActions();
  if (lsScheduledActions != null) {
    if (lsScheduledActions.size() > 0) {
      Iterator<ScheduledAction> it=lsScheduledActions.iterator();
      while (it.hasNext()) {
        ScheduledAction sa=it.next();
        if (deadAddress.equals(sa.getRequest().caller)) {
          node.clusterManager.deregisterScheduledAction(sa);
          sa.setValid(false);
          it.remove();
        }
      }
    }
  }
  if (record.getLockCount() > 0) {
    if (deadAddress.equals(record.getLockAddress())) {
      clearLock(record);
    }
  }
  if (record.getValue() instanceof DistributedSemaphore) {
    DistributedSemaphore semaphore=(DistributedSemaphore)record.getValue();
    if (semaphore.hasPermits(deadAddress)) {
      semaphore.releaseAll(deadAddress);
    }
  }
}
Program: 49917
Project: 49917
Buggy source:
public boolean removeMulti(Request req){
  Record record=getRecord(req);
  if (record == null)   return false;
  boolean removed=false;
  if (req.value == null) {
    removed=true;
    markAsRemoved(record);
  }
 else {
    if (record.containsValue(req.value)) {
      if (record.getMultiValues() != null) {
        removed=record.getMultiValues().remove(req.value);
      }
    }
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  if (removed) {
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record.getKeyData(),null,req.value,record.getListeners(),req.caller);
  }
  req.version=record.getVersion();
  if (record.valueCount() == 0) {
    markAsRemoved(record);
  }
  return removed;
}

Fixed version (ground truth):
public boolean removeMulti(Request req){
  Record record=getRecord(req);
  if (record == null)   return false;
  boolean removed=false;
  if (req.value == null) {
    removed=true;
    markAsRemoved(record);
  }
 else {
    if (record.containsValue(req.value)) {
      if (record.getMultiValues() != null) {
        removed=record.getMultiValues().remove(req.value);
      }
    }
  }
  if (req.txnId != -1) {
    unlock(record,req);
  }
  if (removed) {
    record.incrementVersion();
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_REMOVED,record.getKeyData(),null,req.value,record.getListeners(),req.caller);
  }
  req.version=record.getVersion();
  if (record.valueCount() == 0) {
    markAsRemoved(record);
  }
  return removed;
}
Program: 49918
Project: 49918
Buggy source:
void unlock(Record record){
  record.clearLock();
  fireScheduledActions(record);
}

Fixed version (ground truth):
void unlock(Record record,Request request){
  record.unlock(request.lockThreadId,request.lockAddress);
  fireScheduledActions(record);
}
Program: 49919
Project: 49919
Buggy source:
public boolean removeItem(Request req){
  Record record=getRecord(req);
  if (record == null) {
    return false;
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  boolean removed=false;
  if (record.getCopyCount() > 0) {
    record.decrementCopyCount();
    removed=true;
  }
 else   if (record.getValueData() != null) {
    removed=true;
  }
 else   if (record.getMultiValues() != null) {
    removed=true;
  }
  if (removed) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_REMOVED,null,record,req.caller);
    record.incrementVersion();
  }
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  markAsRemoved(record);
  return true;
}

Fixed version (ground truth):
public boolean removeItem(Request req){
  Record record=getRecord(req);
  if (record == null) {
    return false;
  }
  if (req.txnId != -1) {
    unlock(record,req);
  }
  boolean removed=false;
  if (record.getCopyCount() > 0) {
    record.decrementCopyCount();
    removed=true;
  }
 else   if (record.getValueData() != null) {
    removed=true;
  }
 else   if (record.getMultiValues() != null) {
    removed=true;
  }
  if (removed) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_REMOVED,null,record,req.caller);
    record.incrementVersion();
  }
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  markAsRemoved(record);
  return true;
}
Program: 49920
Project: 49920
Buggy source:
public void run(){
  try {
    map3.lock(1);
    assertTrue(latchLock.await(10,TimeUnit.SECONDS));
  }
 catch (  Throwable e) {
    fail();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    map1.lock(1);
    locked.set(true);
  }
 catch (  Throwable e) {
  }
}
Program: 49921
Project: 49921
Buggy source:
@Test public void testMemberRemoved() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_REMOVED);
  connectionManager.memberRemoved(membershipEvent);
  assertEquals(0,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testMemberRemoved() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_REMOVED);
  connectionManager.memberRemoved(membershipEvent);
  assertEquals(0,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49922
Project: 49922
Buggy source:
@Test public void testDestroyConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  assertEquals(connection,connectionManager.getConnection());
  connectionManager.destroyConnection(connection);
  connectionManager.getConnection();
  assertTrue(latch.await(1,TimeUnit.SECONDS));
  assertArrayEquals(new Object[]{LifecycleState.CLIENT_CONNECTION_OPENING,LifecycleState.CLIENT_CONNECTION_LOST,LifecycleState.CLIENT_CONNECTION_OPENING},lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testDestroyConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  assertEquals(connection,connectionManager.getConnection());
  connectionManager.destroyConnection(connection);
  connectionManager.getConnection();
  assertTrue(latch.await(1,TimeUnit.SECONDS));
  assertArrayEquals(new Object[]{LifecycleState.CLIENT_CONNECTION_OPENING,LifecycleState.CLIENT_CONNECTION_LOST,LifecycleState.CLIENT_CONNECTION_OPENING},lifecycleEvents.toArray());
}
Program: 49923
Project: 49923
Buggy source:
@Test public void testDifferentMemberAdded() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  InetSocketAddress inetSocketAddress2=new InetSocketAddress("String_Node_Str",5702);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress2);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress2);
  assertEquals(2,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testDifferentMemberAdded() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  InetSocketAddress inetSocketAddress2=new InetSocketAddress("String_Node_Str",5702);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress2);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress2);
  assertEquals(2,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49925
Project: 49925
Buggy source:
@Test public void testShouldExecuteOnDisconnect() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  assertTrue(connectionManager.shouldExecuteOnDisconnect(connection));
  assertFalse(connectionManager.shouldExecuteOnDisconnect(connection));
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testShouldExecuteOnDisconnect() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      return connection;
    }
  }
;
  assertTrue(connectionManager.shouldExecuteOnDisconnect(connection));
  assertFalse(connectionManager.shouldExecuteOnDisconnect(connection));
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49926
Project: 49926
Buggy source:
@Test public void testGetConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.getConnection();
  assertEquals(connection,connectionManager.getConnection());
  verify(binder).bind(connection);
  assertEquals(connection,connectionManager.getConnection());
  assertEquals(1,latch.getCount());
  assertArrayEquals(new Object[]{LifecycleState.CLIENT_CONNECTION_OPENING},lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testGetConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.getConnection();
  assertEquals(connection,connectionManager.getConnection());
  verify(binder).bind(connection);
  assertEquals(connection,connectionManager.getConnection());
  assertEquals(1,latch.getCount());
  assertArrayEquals(new Object[]{LifecycleState.CLIENT_CONNECTION_OPENING},lifecycleEvents.toArray());
}
Program: 49927
Project: 49927
Buggy source:
@Test public void testGetConnectionWhenThereIsNoConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      return null;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.getConnection();
  assertEquals(null,connectionManager.getConnection());
  assertEquals(null,connectionManager.getConnection());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testGetConnectionWhenThereIsNoConnection() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      return null;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  connectionManager.getConnection();
  assertEquals(null,connectionManager.getConnection());
  assertEquals(null,connectionManager.getConnection());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49928
Project: 49928
Buggy source:
@Test public void testSameMemberAdded() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress);
  assertEquals(1,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}

Fixed version (ground truth):
@Test public void testSameMemberAdded() throws Exception {
  HazelcastClient client=mock(HazelcastClient.class);
  InetSocketAddress inetSocketAddress=new InetSocketAddress("String_Node_Str",5701);
  final Connection connection=mock(Connection.class);
  final CountDownLatch latch=new CountDownLatch(2);
  final List<LifecycleState> lifecycleEvents=new ArrayList<LifecycleState>();
  final LifecycleServiceClientImpl lifecycleService=createLifecycleServiceClientImpl(client,lifecycleEvents);
  ConnectionManager connectionManager=new ConnectionManager(client,lifecycleService,inetSocketAddress,60000){
    protected Connection getNextConnection(){
      latch.countDown();
      return connection;
    }
  }
;
  ClientBinder binder=mock(ClientBinder.class);
  connectionManager.setBinder(binder);
  Cluster cluster=mock(Cluster.class);
  Member member=mock(Member.class);
  when(member.getInetSocketAddress()).thenReturn(inetSocketAddress);
  MembershipEvent membershipEvent=new MembershipEvent(cluster,member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress);
  assertEquals(1,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49929
Project: 49929
Buggy source:
public int drainTo(Collection<? super E> objects,int i){
  if (objects == null)   throw new NullPointerException("String_Node_Str");
  if (i < 0)   throw new IllegalArgumentException("String_Node_Str" + i);
  if (i == 0)   return 0;
  if (objects instanceof IQueue) {
    if (((IQueue)objects).getName().equals(getName())) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  E e;
  int counter=0;
  while ((e=poll()) != null && counter < i) {
    objects.add(e);
    counter++;
  }
  return counter;
}

Fixed version (ground truth):
public int drainTo(Collection<? super E> objects,int i){
  if (objects == null)   throw new NullPointerException("String_Node_Str");
  if (i < 0)   throw new IllegalArgumentException("String_Node_Str" + i);
  if (i == 0)   return 0;
  if (objects instanceof IQueue) {
    if (((IQueue)objects).getName().equals(getName())) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  E e;
  int counter=0;
  while (counter < i && (e=poll()) != null) {
    objects.add(e);
    counter++;
  }
  return counter;
}
Program: 49930
Project: 49930
Buggy source:
public void removeLogListener(LogListener logListener){
  Iterator<LogListenerRegistration> it=lsListeners.iterator();
  while (it.hasNext()) {
    LogListenerRegistration logListenerRegistration=it.next();
    if (logListenerRegistration.getLogListener() == logListener) {
      it.remove();
    }
  }
}

Fixed version (ground truth):
public void removeLogListener(LogListener logListener){
  lsListeners.remove(new LogListenerRegistration(Level.ALL,logListener));
}
Program: 49931
Project: 49931
Buggy source:
public boolean isEmpty(){
  return (size() == 0);
}

Fixed version (ground truth):
public boolean isEmpty(String name){
  NearCache nearCache=mapCaches.get(name);
  if (nearCache != null && !nearCache.isEmpty()) {
    return false;
  }
  final CMap cMap=maps.get(name);
  if (cMap != null) {
    long now=System.currentTimeMillis();
    for (    Record record : cMap.mapRecords.values()) {
      if (record.isActive() && record.isValid(now) && record.getValueData() != null) {
        if (cMap.readBackupData) {
          return false;
        }
 else {
          Partition partition=partitionManager.partitionServiceImpl.getPartition(record.getBlockId());
          if (partition != null && partition.getOwner() != null && partition.getOwner().localMember()) {
            return false;
          }
        }
      }
    }
  }
  return new MSize(name).getSize() == 0;
}
Program: 49934
Project: 49934
Buggy source:
public HazelcastClient getHazelcastClient(){
  if (client == null) {
    Config config=new Config();
    config.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN,"String_Node_Str");
    hz=Hazelcast.newHazelcastInstance(config);
    client=TestUtility.newHazelcastClient(hz);
  }
  return client;
}

Fixed version (ground truth):
public HazelcastClient getHazelcastClient(){
  if (client == null) {
    Config config=new Config();
    config.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN,"String_Node_Str");
    config.setProperty(GroupProperties.PROP_EXECUTOR_CLIENT_THREAD_COUNT,"String_Node_Str");
    hz=Hazelcast.newHazelcastInstance(config);
    client=TestUtility.newHazelcastClient(hz);
  }
  return client;
}
Program: 49935
Project: 49935
Buggy source:
public void searchForOtherClusters(SplitBrainHandler splitBrainHandler){
  final BlockingQueue q=new LinkedBlockingQueue();
  MulticastListener listener=new MulticastListener(){
    public void onMessage(    Object msg){
      if (msg != null && msg instanceof JoinInfo) {
        JoinInfo joinInfo=(JoinInfo)msg;
        if (node.address != null && !node.address.equals(joinInfo.address)) {
          q.offer(msg);
        }
      }
    }
  }
;
  node.multicastService.addMulticastListener(listener);
  node.multicastService.send(node.createJoinInfo());
  try {
    JoinInfo joinInfo=(JoinInfo)q.poll(3,TimeUnit.SECONDS);
    if (joinInfo != null) {
      node.multicastService.removeMulticastListener(listener);
      if (shouldMerge(joinInfo)) {
        logger.log(Level.WARNING,node.address + "String_Node_Str" + joinInfo.address);
        node.factory.restart();
        return;
      }
    }
  }
 catch (  InterruptedException ignored) {
  }
catch (  Exception e) {
    if (logger != null) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
public void searchForOtherClusters(SplitBrainHandler splitBrainHandler){
  final BlockingQueue q=new LinkedBlockingQueue();
  MulticastListener listener=new MulticastListener(){
    public void onMessage(    Object msg){
      if (msg != null && msg instanceof JoinInfo) {
        JoinInfo joinInfo=(JoinInfo)msg;
        if (node.address != null && !node.address.equals(joinInfo.address)) {
          q.offer(msg);
        }
      }
    }
  }
;
  node.multicastService.addMulticastListener(listener);
  node.multicastService.send(node.createJoinInfo());
  try {
    JoinInfo joinInfo=(JoinInfo)q.poll(3,TimeUnit.SECONDS);
    if (joinInfo != null) {
      if (shouldMerge(joinInfo)) {
        logger.log(Level.WARNING,node.address + "String_Node_Str" + joinInfo.address);
        node.factory.restart();
        return;
      }
    }
  }
 catch (  InterruptedException ignored) {
  }
catch (  Exception e) {
    if (logger != null) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
 finally {
    node.multicastService.removeMulticastListener(listener);
  }
}
Program: 49936
Project: 49936
Buggy source:
@Override public Iterator<E> iterator(){
  final Collection<E> collection=proxyHelper.keys(null);
  final AbstractCollection<E> proxy=this;
  return new Iterator<E>(){
    Iterator<E> iterator=collection.iterator();
    volatile E lastRecord;
    public boolean hasNext(){
      return iterator.hasNext();
    }
    public E next(){
      lastRecord=iterator.next();
      return lastRecord;
    }
    public void remove(){
      iterator.remove();
      proxy.remove(lastRecord);
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<E> iterator(){
  final Collection<E> collection=getTheCollection();
  final AbstractCollection<E> proxy=this;
  return new Iterator<E>(){
    Iterator<E> iterator=collection.iterator();
    volatile E lastRecord;
    public boolean hasNext(){
      return iterator.hasNext();
    }
    public E next(){
      lastRecord=iterator.next();
      return lastRecord;
    }
    public void remove(){
      iterator.remove();
      proxy.remove(lastRecord);
    }
  }
;
}
Program: 49937
Project: 49937
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.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 {
            proxy=new LockClientProxy(o,this);
          }
          mapProxies.put(o,proxy);
        }
 else {
          proxy=new LockClientProxy(o,this);
        }
      }
    }
  }
  return mapProxies.get(o);
}
Program: 49938
Project: 49938
Buggy source:
public <E>IList<E> getList(String name){
  return (IList<E>)getClientProxy(Prefix.LIST + name);
}

Fixed version (ground truth):
public <E>IList<E> getList(String name){
  return (IList<E>)getClientProxy(Prefix.AS_LIST + name);
}
Program: 49939
Project: 49939
Buggy source:
public String getName(){
  return name.substring(Prefix.LIST.length());
}

Fixed version (ground truth):
public String getName(){
  return name.substring(Prefix.AS_LIST.length());
}