nus-yam/ex-repair huggingface dataset:
Program: 49406
Project: 49406
Buggy source:
/** 
 * Creates a new SecondExecutorService that will run all second operations in bulk. Imagine a write-behind map where dirty entries will be stored in bulk. Note that each key can be only once; meaning you cannot delay the execution Once an entry is marked as dirty for example, it will run in write-delay-seconds, even if the entry is updated again within write-delay-seconds. So two things to remember: 1. a key cannot be re-scheduled (postponing its execution). 2. all entries scheduled for a given second will be executed in once by your SecondBulkExecutor implementation. Once a key is executed, it can be re-scheduled for another execution. <p/> SecondExecutorService implementation is thread-safe.
 * @param es  ScheduledExecutorService instance to execute the second
 * @param stf bulk executor
 * @return SecondExecutorService
 */
public SecondExecutorService newSecondBulkExecutor(ScheduledExecutorService es,SecondBulkTaskFactory stf){
  return new SecondScheduler(es,stf);
}

Fixed version (ground truth):
/** 
 * Creates a new SecondExecutorService that will run all second operations in bulk. Imagine a write-behind map where dirty entries will be stored in bulk. Note that each key can be only once; meaning you cannot delay the execution Once an entry is marked as dirty for example, it will run in write-delay-seconds, even if the entry is updated again within write-delay-seconds. So two things to remember: 1. a key cannot be re-scheduled (postponing its execution). 2. all entries scheduled for a given second will be executed in once by your SecondBulkExecutor implementation. Once a key is executed, it can be re-scheduled for another execution. <p/> SecondExecutorService implementation is thread-safe.
 * @param es  ScheduledExecutorService instance to execute the second
 * @param stf bulk executor
 * @return SecondExecutorService
 */
public static SecondExecutorService newSecondBulkExecutor(ScheduledExecutorService es,SecondBulkTaskFactory stf){
  return new SecondScheduler(es,stf);
}
Program: 49407
Project: 49407
Buggy source:
public void executeAll(SecondExecutorService ses,ConcurrentMap<Object,Object> entries,int delaySecond){
  for (  Object o : entries.values()) {
    System.out.println(o);
  }
}

Fixed version (ground truth):
public void executeAll(SecondExecutorService ses,ConcurrentMap<Object,Object> entries,int delaySecond){
  for (  Object o : entries.values()) {
    System.out.println("String_Node_Str" + o);
  }
}
Program: 49408
Project: 49408
Buggy source:
@Override public synchronized void run(){
  while (true) {
    System.out.println(secondScheduler);
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void run(){
  while (true) {
    System.out.println(ses);
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 49409
Project: 49409
Buggy source:
public static void main(String[] args) throws Exception {
  SecondTaskFactory secondTaskFactory=new SecondTaskFactory(){
    public SecondTask newSecondTask(){
      return new SecondBulkTask(){
        public void executeAll(        SecondExecutorService ses,        ConcurrentMap<Object,Object> entries,        int delaySecond){
          for (          Object o : entries.values()) {
            System.out.println(o);
          }
        }
        public void endSecond(){
        }
      }
;
    }
  }
;
  final ScheduledExecutorService ses=Executors.newScheduledThreadPool(10);
  final SecondScheduler secondScheduler=new SecondScheduler(ses,secondTaskFactory);
  new Thread(){
    @Override public synchronized void run(){
      while (true) {
        System.out.println(secondScheduler);
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
.start();
  while (true) {
    for (int i=0; i < 10; i++) {
      schedule(true,secondScheduler,i,100);
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  final ScheduledExecutorService se=Executors.newScheduledThreadPool(10);
  final SecondBulkTaskFactory sbtf=new SecondBulkTaskFactory(){
    @Override public SecondBulkTask newSecondTask(){
      return new SecondBulkTask(){
        public void executeAll(        SecondExecutorService ses,        ConcurrentMap<Object,Object> entries,        int delaySecond){
          for (          Object o : entries.values()) {
            System.out.println("String_Node_Str" + o);
          }
        }
        public void endSecond(){
        }
      }
;
    }
  }
;
  final SecondEntryTaskFactory setf=new SecondEntryTaskFactory(){
    @Override public SecondEntryTask newSecondTask(){
      return new SecondEntryTask(){
        @Override public void executeEntry(        SecondExecutorService ses,        Map.Entry entry,        int delaySeconds){
          System.out.println("String_Node_Str" + entry.getValue());
        }
        public void endSecond(){
        }
      }
;
    }
  }
;
  final SecondExecutorService ses=SecondExecutorServiceFactory.newSecondBulkExecutor(se,sbtf);
  new Thread(){
    @Override public synchronized void run(){
      while (true) {
        System.out.println(ses);
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
.start();
  for (int i=0; i < 10; i++) {
    ses.schedule(100,i,"String_Node_Str" + i);
    ses.schedule(100,i,"String_Node_Str" + i);
    ses.schedule(100,i,"String_Node_Str" + i);
  }
  for (int i=10; i < 20; i++) {
    ses.schedule(3330,i,"String_Node_Str" + i);
    ses.schedule(4330,i,"String_Node_Str" + i);
    ses.schedule(5330,i,"String_Node_Str" + i);
  }
}
Program: 49410
Project: 49410
Buggy source:
void execute(final Integer second,final int delaySecond){
  ses.schedule(new Runnable(){
    public void run(){
      final ConcurrentMap<Object,Object> scheduledKeys=secondObjects.remove(second);
      final SecondTask secondTask=secondTaskFactory.newSecondTask();
      try {
        if (bulk) {
          final SecondBulkTask sbe=(SecondBulkTask)secondTask;
          for (          Object o : scheduledKeys.keySet()) {
            keySeconds.remove(o);
          }
          sbe.executeAll(SecondScheduler.this,scheduledKeys,delaySecond);
        }
 else {
          final SecondEntryTask see=(SecondEntryTask)secondTask;
          for (          Map.Entry<Object,Object> object : scheduledKeys.entrySet()) {
            final Object scheduleKey=object.getKey();
            if (keySeconds.remove(scheduleKey,second)) {
              try {
                see.executeEntry(SecondScheduler.this,object,delaySecond);
              }
 catch (              Exception ignored) {
              }
            }
          }
        }
      }
 catch (      Throwable ignored) {
        ignored.printStackTrace();
      }
 finally {
        secondTask.endSecond();
      }
    }
  }
,delaySecond,TimeUnit.SECONDS);
  System.out.println("String_Node_Str" + second);
}

Fixed version (ground truth):
void execute(final Integer second,final int delaySecond){
  ses.schedule(new Runnable(){
    public void run(){
      final ConcurrentMap<Object,Object> scheduledKeys=secondObjects.remove(second);
      if (scheduledKeys == null || scheduledKeys.isEmpty())       return;
      final SecondTask secondTask=secondTaskFactory.newSecondTask();
      try {
        if (bulk) {
          final SecondBulkTask sbe=(SecondBulkTask)secondTask;
          for (          Object o : scheduledKeys.keySet()) {
            keySeconds.remove(o);
          }
          sbe.executeAll(SecondScheduler.this,scheduledKeys,delaySecond);
        }
 else {
          final SecondEntryTask see=(SecondEntryTask)secondTask;
          for (          Map.Entry<Object,Object> object : scheduledKeys.entrySet()) {
            final Object scheduleKey=object.getKey();
            if (keySeconds.remove(scheduleKey,second)) {
              try {
                see.executeEntry(SecondScheduler.this,object,delaySecond);
              }
 catch (              Exception ignored) {
              }
            }
          }
        }
      }
 catch (      Throwable ignored) {
        ignored.printStackTrace();
      }
 finally {
        secondTask.endSecond();
      }
    }
  }
,delaySecond,TimeUnit.SECONDS);
}
Program: 49411
Project: 49411
Buggy source:
private static void schedule(boolean update,SecondScheduler secondScheduler,final Object key,final long millis){
  if (update) {
    secondScheduler.schedule(millis,key,"String_Node_Str" + key);
  }
 else {
    secondScheduler.scheduleIfNew(millis,key,"String_Node_Str" + key);
  }
}

Fixed version (ground truth):
public boolean schedule(long delayMillis,Object key,Object object){
  if (bulk) {
    return scheduleIfNew(delayMillis,key,object);
  }
 else {
    return scheduleEntry(delayMillis,key,object);
  }
}
Program: 49412
Project: 49412
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + keySeconds.size() + "String_Node_Str"+ secondObjects.keySet()+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + keySeconds.size() + "String_Node_Str"+ secondObjects.size()+ "String_Node_Str"+ secondObjects.keySet()+ '}';
}
Program: 49413
Project: 49413
Buggy source:
public SecondTask newSecondTask(){
  return new SecondBulkTask(){
    public void executeAll(    SecondExecutorService ses,    ConcurrentMap<Object,Object> entries,    int delaySecond){
      for (      Object o : entries.values()) {
        System.out.println(o);
      }
    }
    public void endSecond(){
    }
  }
;
}

Fixed version (ground truth):
@Override public SecondEntryTask newSecondTask(){
  return new SecondEntryTask(){
    @Override public void executeEntry(    SecondExecutorService ses,    Map.Entry entry,    int delaySeconds){
      System.out.println("String_Node_Str" + entry.getValue());
    }
    public void endSecond(){
    }
  }
;
}
Program: 49414
Project: 49414
Buggy source:
public ExecutorService getExecutorService(String name){
  if (name == null)   throw new IllegalArgumentException("String_Node_Str");
  ExecutorServiceClientProxy executorServiceProxy=mapExecutors.get(name);
  if (executorServiceProxy == null) {
    executorServiceProxy=new ExecutorServiceClientProxy(this,name);
    ExecutorServiceClientProxy old=mapExecutors.putIfAbsent(name,executorServiceProxy);
    if (old != null) {
      executorServiceProxy=old;
    }
  }
  return executorServiceProxy;
}

Fixed version (ground truth):
public IExecutorService getExecutorService(String name){
  if (name == null)   throw new IllegalArgumentException("String_Node_Str");
  ExecutorServiceClientProxy executorServiceProxy=mapExecutors.get(name);
  if (executorServiceProxy == null) {
    executorServiceProxy=new ExecutorServiceClientProxy(this,name);
    ExecutorServiceClientProxy old=mapExecutors.putIfAbsent(name,executorServiceProxy);
    if (old != null) {
      executorServiceProxy=old;
    }
  }
  return null;
}
Program: 49415
Project: 49415
Buggy source:
public void addIndex(Expression<?> expression,boolean ordered){
  proxyHelper.doCommand(Command.MADDINDEX,new String[]{getName(),String.valueOf(ordered)},proxyHelper.toData(expression));
}

Fixed version (ground truth):
public void addIndex(String attribute,boolean ordered){
  proxyHelper.doCommand(Command.MADDINDEX,new String[]{getName(),attribute,String.valueOf(ordered)},null);
}
Program: 49416
Project: 49416
Buggy source:
public void flush(boolean flushAllEntries){
}

Fixed version (ground truth):
public void flush(){
  proxyHelper.doCommand(Command.MFLUSH,getName(),null);
}
Program: 49417
Project: 49417
Buggy source:
@Override public void beforeRun() throws Exception {
  if (operations == null && operationData != null) {
    final NodeEngine nodeEngine=getNodeEngine();
    final int len=operationData.length;
    operations=new Operation[len];
    for (int i=0; i < len; i++) {
      final Operation op=(Operation)nodeEngine.toObject(operationData[i]);
      op.setNodeEngine(nodeEngine).setCaller(getCaller()).setConnection(getConnection()).setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler());
      OperationAccessor.setCallId(op,getCallId());
      operations[i]=op;
    }
  }
}

Fixed version (ground truth):
@Override public void beforeRun() throws Exception {
  if (operations != null && operations.length > 0) {
    final NodeEngine nodeEngine=getNodeEngine();
    final int len=operations.length;
    for (int i=0; i < len; i++) {
      final Operation op=operations[i];
      op.setNodeEngine(nodeEngine).setCaller(getCaller()).setConnection(getConnection()).setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler());
      OperationAccessor.setCallId(op,getCallId());
      operations[i]=op;
    }
  }
}
Program: 49418
Project: 49418
Buggy source:
@Override protected void readInternal(final ObjectDataInput in) throws IOException {
  int len=in.readInt();
  operationData=new Data[len];
  for (int i=0; i < len; i++) {
    operationData[i]=new Data();
    operationData[i].readData(in);
  }
}

Fixed version (ground truth):
@Override protected void readInternal(final ObjectDataInput in) throws IOException {
  final int len=in.readInt();
  operations=new Operation[len];
  for (int i=0; i < len; i++) {
    operations[i]=in.readObject();
  }
}
Program: 49419
Project: 49419
Buggy source:
@Override protected void writeInternal(final ObjectDataOutput out) throws IOException {
  prepareToWrite();
  int len=operationData.length;
  out.writeInt(len);
  for (  Data op : operationData) {
    op.writeData(out);
  }
}

Fixed version (ground truth):
@Override protected void writeInternal(final ObjectDataOutput out) throws IOException {
  final int len=operations != null ? operations.length : 0;
  out.writeInt(len);
  if (len > 0) {
    for (    Operation op : operations) {
      out.writeObject(op);
    }
  }
}
Program: 49420
Project: 49420
Buggy source:
public void dispatchEvent(Data data,EntryListener listener){
  EventData eventData=(EventData)nodeEngine.toObject(data);
  Member member=nodeEngine.getClusterService().getMember(eventData.getCaller());
  EntryEvent event=null;
  if (eventData.getDataOldValue() == null) {
    event=new EntryEvent(eventData.getSource(),member,eventData.getEventType(),toObject(eventData.getDataKey()),toObject(eventData.getDataNewValue()));
  }
 else {
    event=new EntryEvent(eventData.getSource(),member,eventData.getEventType(),toObject(eventData.getDataKey()),toObject(eventData.getDataOldValue()),toObject(eventData.getDataNewValue()));
  }
switch (event.getEventType()) {
case ADDED:
    listener.entryAdded(event);
  break;
case EVICTED:
listener.entryEvicted(event);
break;
case UPDATED:
listener.entryUpdated(event);
break;
case REMOVED:
listener.entryRemoved(event);
break;
}
}

Fixed version (ground truth):
public void dispatchEvent(EventData eventData,EntryListener listener){
  Member member=nodeEngine.getClusterService().getMember(eventData.getCaller());
  EntryEvent event=null;
  if (eventData.getDataOldValue() == null) {
    event=new EntryEvent(eventData.getSource(),member,eventData.getEventType(),toObject(eventData.getDataKey()),toObject(eventData.getDataNewValue()));
  }
 else {
    event=new EntryEvent(eventData.getSource(),member,eventData.getEventType(),toObject(eventData.getDataKey()),toObject(eventData.getDataOldValue()),toObject(eventData.getDataNewValue()));
  }
switch (event.getEventType()) {
case ADDED:
    listener.entryAdded(event);
  break;
case EVICTED:
listener.entryEvicted(event);
break;
case UPDATED:
listener.entryUpdated(event);
break;
case REMOVED:
listener.entryRemoved(event);
break;
}
}
Program: 49421
Project: 49421
Buggy source:
public void publishEvent(Address caller,String mapName,int eventType,Data dataKey,Data dataOldValue,Data dataValue){
  Collection<EventRegistration> candidates=nodeEngine.getEventService().getRegistrations(MAP_SERVICE_NAME,mapName);
  Set<EventRegistration> registrationsWithValue=new HashSet<EventRegistration>();
  Set<EventRegistration> registrationsWithoutValue=new HashSet<EventRegistration>();
  for (  EventRegistration candidate : candidates) {
    EntryEventFilter filter=(EntryEventFilter)candidate.getFilter();
    if (filter.eval(dataKey)) {
      if (filter.isIncludeValue()) {
        registrationsWithValue.add(candidate);
      }
 else {
        registrationsWithoutValue.add(candidate);
      }
    }
  }
  if (registrationsWithValue.isEmpty() && registrationsWithoutValue.isEmpty())   return;
  String source=nodeEngine.getNode().address.toString();
  EventData event=new EventData(source,caller,dataKey,dataValue,dataOldValue,eventType);
  nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME,registrationsWithValue,toData(event));
  nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME,registrationsWithoutValue,toData(event.cloneWithoutValues()));
}

Fixed version (ground truth):
public void publishEvent(Address caller,String mapName,int eventType,Data dataKey,Data dataOldValue,Data dataValue){
  Collection<EventRegistration> candidates=nodeEngine.getEventService().getRegistrations(MAP_SERVICE_NAME,mapName);
  Set<EventRegistration> registrationsWithValue=new HashSet<EventRegistration>();
  Set<EventRegistration> registrationsWithoutValue=new HashSet<EventRegistration>();
  for (  EventRegistration candidate : candidates) {
    EntryEventFilter filter=(EntryEventFilter)candidate.getFilter();
    if (filter.eval(dataKey)) {
      if (filter.isIncludeValue()) {
        registrationsWithValue.add(candidate);
      }
 else {
        registrationsWithoutValue.add(candidate);
      }
    }
  }
  if (registrationsWithValue.isEmpty() && registrationsWithoutValue.isEmpty())   return;
  String source=nodeEngine.getNode().address.toString();
  EventData event=new EventData(source,caller,dataKey,dataValue,dataOldValue,eventType);
  nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME,registrationsWithValue,event);
  nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME,registrationsWithoutValue,event.cloneWithoutValues());
}
Program: 49422
Project: 49422
Buggy source:
public Map<Integer,DataSerializableFactory> getFactories(){
  final Map<Integer,DataSerializableFactory> factories=new HashMap<Integer,DataSerializableFactory>();
  factories.put(RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new Response();
    }
  }
);
  factories.put(MULTI_RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new MultiResponse();
    }
  }
);
  factories.put(EVENT_PACKET,new DataSerializableFactory(){
    public DataSerializable create(){
      return new EventPacket();
    }
  }
);
  factories.put(PARTITION_ITERATOR,new DataSerializableFactory(){
    public DataSerializable create(){
      return new PartitionIteratingOperation();
    }
  }
);
  factories.put(PARTITION_RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new PartitionResponse();
    }
  }
);
  factories.put(OPERATION_WRAPPER,new DataSerializableFactory(){
    public DataSerializable create(){
      return new OperationWrapper();
    }
  }
);
  return factories;
}

Fixed version (ground truth):
public Map<Integer,DataSerializableFactory> getFactories(){
  final Map<Integer,DataSerializableFactory> factories=new HashMap<Integer,DataSerializableFactory>();
  factories.put(DATA,new DataSerializableFactory(){
    public DataSerializable create(){
      return new Data();
    }
  }
);
  factories.put(RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new Response();
    }
  }
);
  factories.put(MULTI_RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new MultiResponse();
    }
  }
);
  factories.put(EVENT_PACKET,new DataSerializableFactory(){
    public DataSerializable create(){
      return new EventPacket();
    }
  }
);
  factories.put(PARTITION_ITERATOR,new DataSerializableFactory(){
    public DataSerializable create(){
      return new PartitionIteratingOperation();
    }
  }
);
  factories.put(PARTITION_RESPONSE,new DataSerializableFactory(){
    public DataSerializable create(){
      return new PartitionResponse();
    }
  }
);
  factories.put(OPERATION_WRAPPER,new DataSerializableFactory(){
    public DataSerializable create(){
      return new OperationWrapper();
    }
  }
);
  return factories;
}
Program: 49423
Project: 49423
Buggy source:
TaskPoller(){
  super(factory.node.threadGroup,factory.node.getThreadNamePrefix("String_Node_Str"));
  register(new RuntimeStateRequest());
  register(new ThreadDumpRequest());
  register(new ExecuteScriptRequest());
  register(new EvictLocalMapRequest());
  register(new ConsoleCommandRequest());
  register(new MapConfigRequest());
  register(new DetectDeadlockRequest());
  register(new MemberConfigRequest());
  register(new ClusterPropsRequest());
  register(new SetLogLevelRequest());
  register(new GetLogLevelRequest());
  register(new GetVersionRequest());
  register(new GetLogsRequest());
  register(new RunGcRequest());
  register(new GetMemberSystemPropertiesRequest());
  register(new GetMapEntryRequest());
  register(new LogVersionMismatchRequest());
  register(new ShutdownMemberRequest());
}

Fixed version (ground truth):
TaskPoller(){
  super(factory.node.threadGroup,factory.node.getThreadNamePrefix("String_Node_Str"));
  register(new RuntimeStateRequest());
  register(new ThreadDumpRequest());
  register(new ExecuteScriptRequest());
  register(new EvictLocalMapRequest());
  register(new ConsoleCommandRequest());
  register(new MapConfigRequest());
  register(new DetectDeadlockRequest());
  register(new MemberConfigRequest());
  register(new ClusterPropsRequest());
  register(new SetLogLevelRequest());
  register(new GetLogLevelRequest());
  register(new GetVersionRequest());
  register(new GetLogsRequest());
  register(new RunGcRequest());
  register(new GetMemberSystemPropertiesRequest());
  register(new GetMapEntryRequest());
  register(new VersionMismatchLogRequest());
  register(new ShutdownMemberRequest());
}
Program: 49424
Project: 49424
Buggy source:
public static void removeTransaction(){
  ThreadContext.get().setAttachment(null);
}

Fixed version (ground truth):
public static void removeTransaction(){
}
Program: 49425
Project: 49425
Buggy source:
public static Transaction getTransaction(HazelcastClient client){
  final ThreadContext ctx=ThreadContext.get();
  TransactionClientProxy transactionProxy=ctx.getAttachment();
  if (transactionProxy == null) {
    transactionProxy=new TransactionClientProxy(null,client);
    ctx.setAttachment(transactionProxy);
  }
  return transactionProxy;
}

Fixed version (ground truth):
public static Transaction getTransaction(HazelcastClient client){
  final ThreadContext ctx=ThreadContext.get();
  return null;
}
Program: 49426
Project: 49426
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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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(member,MembershipEvent.MEMBER_REMOVED);
  connectionManager.memberRemoved(membershipEvent);
  assertEquals(0,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49427
Project: 49427
Buggy source:
@Test @Ignore 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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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 @Ignore 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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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(member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress2);
  assertEquals(2,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49428
Project: 49428
Buggy source:
@Test @Ignore 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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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 @Ignore 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);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.setCredentials(credentials).addInetSocketAddress(inetSocketAddress).setConnectionTimeout(60000);
  ConnectionManager connectionManager=new ConnectionManager(client,clientConfig,lifecycleService){
    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(member,MembershipEvent.MEMBER_ADDED);
  connectionManager.memberAdded(membershipEvent);
  connectionManager.getClusterMembers().contains(inetSocketAddress);
  assertEquals(1,connectionManager.getClusterMembers().size());
  assertArrayEquals(new Object[0],lifecycleEvents.toArray());
}
Program: 49429
Project: 49429
Buggy source:
public void connectionRemoved(Connection connection){
  LifecycleServiceImpl lifecycleService=(LifecycleServiceImpl)node.factory.getLifecycleService();
  if (connection.equals(this.conn) && !lifecycleService.paused.get()) {
    destroyEndpointThreads();
    rollbackTransactions();
    removeEntryListeners();
    removeEntryListenersWithKey();
    removeMessageListeners();
    cancelRunningOperations();
    releaseAttachedSemaphorePermits();
    node.clusterManager.sendProcessableToAll(new ClientHandlerService.ClientDisconnect(node.address),true);
    node.clientService.remove(this);
  }
}

Fixed version (ground truth):
public void connectionRemoved(Connection connection){
  LifecycleServiceImpl lifecycleService=(LifecycleServiceImpl)node.factory.getLifecycleService();
  if (connection.equals(this.conn) && !lifecycleService.paused.get()) {
    destroyEndpointThreads();
    rollbackTransactions();
    removeEntryListeners();
    removeEntryListenersWithKey();
    removeMessageListeners();
    cancelRunningOperations();
    releaseAttachedSemaphorePermits();
    node.clusterManager.sendProcessableToAll(new ClientHandlerService.CountDownLatchLeave(conn.getEndPoint()),true);
    node.clientService.remove(this);
  }
}
Program: 49430
Project: 49430
Buggy source:
public void writeData(DataOutput out) throws IOException {
  deadAddress.writeData(out);
}

Fixed version (ground truth):
public void writeData(DataOutput out) throws IOException {
  out.writeInt(partitionId);
  boolean hasOwner=(owner != null);
  out.writeBoolean(hasOwner);
  if (hasOwner) {
    owner.writeData(out);
  }
}
Program: 49431
Project: 49431
Buggy source:
public void readData(DataInput in) throws IOException {
  (deadAddress=new Address()).readData(in);
}

Fixed version (ground truth):
public void readData(DataInput in) throws IOException {
  partitionId=in.readInt();
  boolean hasOwner=in.readBoolean();
  if (hasOwner) {
    owner=new MemberImpl();
    owner.readData(in);
  }
}
Program: 49432
Project: 49432
Buggy source:
public void process(){
  node.blockingQueueManager.syncForDead(deadAddress);
  node.concurrentMapManager.syncForDeadCountDownLatches(deadAddress);
}

Fixed version (ground truth):
public void process(){
  node.concurrentMapManager.syncForDeadCountDownLatches(deadAddress);
}
Program: 49433
Project: 49433
Buggy source:
void processResult(Object result) throws InterruptedException, ExecutionException, TimeoutException {
  if (result == null) {
    throw new TimeoutException();
  }
 else   if (result instanceof Throwable) {
    if (result instanceof InterruptedException) {
      throw (InterruptedException)result;
    }
 else     if (result instanceof ExecutionException) {
      throw (ExecutionException)result;
    }
 else     if (result instanceof TimeoutException) {
      throw (TimeoutException)result;
    }
 else {
      throw new ExecutionException((Throwable)result);
    }
  }
 else   if (result instanceof Packet) {
    setResult(ProxyHelper.getValue((Packet)result));
  }
 else {
    setResult(result);
  }
}

Fixed version (ground truth):
void processResult(Object result) throws InterruptedException, ExecutionException, TimeoutException {
  if (result == null) {
    throw new TimeoutException();
  }
 else   if (result instanceof Throwable) {
    if (result instanceof InterruptedException) {
      throw (InterruptedException)result;
    }
 else     if (result instanceof ExecutionException) {
      throw (ExecutionException)result;
    }
 else     if (result instanceof TimeoutException) {
      throw (TimeoutException)result;
    }
 else {
      throw new ExecutionException((Throwable)result);
    }
  }
 else {
    setResult(result);
  }
}
Program: 49434
Project: 49434
Buggy source:
public AtomicNumberClientProxy(HazelcastClient hazelcastClient,String name){
  this.name=name;
  this.proxyHelper=new ProxyHelper(name,hazelcastClient);
}

Fixed version (ground truth):
public AtomicNumberClientProxy(HazelcastClient hazelcastClient,String name){
  this.name=name;
  this.proxyHelper=new PacketProxyHelper(name,hazelcastClient);
}
Program: 49435
Project: 49435
Buggy source:
public boolean compareAndSet(long expect,long update){
  return (Boolean)proxyHelper.doOp(ATOMIC_NUMBER_COMPARE_AND_SET,expect,update);
}

Fixed version (ground truth):
public boolean compareAndSet(long expect,long update){
  return false;
}
Program: 49436
Project: 49436
Buggy source:
public long getAndAdd(long delta){
  return (Long)proxyHelper.doOp(ATOMIC_NUMBER_GET_AND_ADD,0L,delta);
}

Fixed version (ground truth):
public long getAndAdd(long delta){
  return 0;
}
Program: 49437
Project: 49437
Buggy source:
public long addAndGet(long delta){
  return (Long)proxyHelper.doOp(ATOMIC_NUMBER_ADD_AND_GET,0L,delta);
}

Fixed version (ground truth):
public long addAndGet(long delta){
  return 0;
}
Program: 49438
Project: 49438
Buggy source:
public long getAndSet(long newValue){
  return (Long)proxyHelper.doOp(ATOMIC_NUMBER_GET_AND_SET,0L,newValue);
}

Fixed version (ground truth):
public long getAndSet(long newValue){
  return 0;
}
Program: 49439
Project: 49439
Buggy source:
public Call(Long id,Packet request){
  this.id=id;
  this.request=request;
  if (request != null) {
    this.request.setCallId(id);
  }
}

Fixed version (ground truth):
public Call(Long id,Object request){
  this.id=id;
  this.request=request;
}
Program: 49440
Project: 49440
Buggy source:
public Packet getRequest(){
  return request;
}

Fixed version (ground truth):
public Object getRequest(){
  return request;
}
Program: 49441
Project: 49441
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + id + "String_Node_Str"+ (request != null ? request.getOperation() : null);
}

Fixed version (ground truth):
@Override public String toString(){
  return request == null ? "String_Node_Str" : request.toString();
}
Program: 49442
Project: 49442
Buggy source:
public Collection<Instance> getInstances(){
  Keys instances=(Keys)proxyHelper.doOp(ClusterOperation.GET_INSTANCES,null,null);
  List<Instance> list=new ArrayList<Instance>();
  if (instances != null) {
    for (    Data data : instances) {
    }
  }
  return list;
}

Fixed version (ground truth):
public Collection<Instance> getInstances(){
  List<Instance> list=new ArrayList<Instance>();
  return list;
}
Program: 49443
Project: 49443
Buggy source:
public void addInstanceListener(InstanceListener listener){
  check(listener);
  if (instanceListenerManager().noListenerRegistered()) {
    Call c=instanceListenerManager().createNewAddListenerCall(proxyHelper);
    proxyHelper.doCall(c);
  }
  instanceListenerManager().registerListener(listener);
}

Fixed version (ground truth):
public void addInstanceListener(InstanceListener listener){
}
Program: 49444
Project: 49444
Buggy source:
public ClusterClientProxy(HazelcastClient client){
  this.client=client;
  proxyHelper=new ProxyHelper("String_Node_Str",client);
}

Fixed version (ground truth):
public ClusterClientProxy(HazelcastClient client){
  this.client=client;
  protocolProxyHelper=new ProtocolProxyHelper("String_Node_Str",client);
}
Program: 49445
Project: 49445
Buggy source:
public long getClusterTime(){
  return (Long)proxyHelper.doOp(ClusterOperation.GET_CLUSTER_TIME,null,null);
}

Fixed version (ground truth):
public long getClusterTime(){
  return 0;
}
Program: 49446
Project: 49446
Buggy source:
public Set<Member> getMembers(){
  Keys cw=(Keys)proxyHelper.doOp(ClusterOperation.GET_MEMBERS,null,null);
  Collection<Data> datas=cw.getKeys();
  Set<Member> set=new LinkedHashSet<Member>();
  for (  Data d : datas) {
    set.add((Member)IOUtil.toObject(d.buffer));
  }
  return set;
}

Fixed version (ground truth):
public Set<Member> getMembers(){
  Protocol protocol=protocolProxyHelper.doCommand(Command.MEMBERS,(String[])null,null);
  Set<Member> members=new HashSet<Member>();
  for (  String arg : protocol.args) {
    String[] address=arg.split("String_Node_Str");
    System.out.println(arg + "String_Node_Str" + address[0]+ "String_Node_Str"+ address[1]);
    try {
      Member member=new MemberImpl(new Address(address[0],Integer.valueOf(address[1])),false);
      members.add(member);
    }
 catch (    UnknownHostException e) {
      e.printStackTrace();
    }
  }
  return members;
}
Program: 49447
Project: 49447
Buggy source:
public void handleMaster(Master master){
  if (!node.joined() && !thisAddress.equals(master.address)) {
    logger.log(Level.FINEST,"String_Node_Str" + master);
    final Address currentMaster=node.getMasterAddress();
    if (currentMaster != null && !currentMaster.equals(master.address)) {
      final Connection conn=node.connectionManager.getConnection(currentMaster);
      if (conn != null && conn.live()) {
        logger.log(Level.FINEST,"String_Node_Str" + master + "String_Node_Str"+ currentMaster);
        return;
      }
    }
    node.setMasterAddress(master.address);
    final Connection connMaster=node.connectionManager.getOrConnect(master.address);
    if (connMaster != null) {
      sendJoinRequest(master.address,true);
    }
  }
}

Fixed version (ground truth):
public void handleMaster(Master master){
  if (!node.joined() && !thisAddress.equals(master.address)) {
    logger.log(Level.FINEST,"String_Node_Str" + master);
    final Address currentMaster=node.getMasterAddress();
    if (currentMaster != null && !currentMaster.equals(master.address)) {
      final Connection conn=node.connectionManager.getConnection(currentMaster);
      if (conn != null && conn.live()) {
        logger.log(Level.FINEST,"String_Node_Str" + master + "String_Node_Str"+ currentMaster);
        return;
      }
    }
    node.setMasterAddress(master.address);
    node.connectionManager.getOrConnect(master.address);
    if (!sendJoinRequest(master.address,true)) {
      logger.log(Level.WARNING,"String_Node_Str" + master.address);
    }
  }
}
Program: 49448
Project: 49448
Buggy source:
public boolean sendJoinRequest(Address toAddress,boolean withCredentials){
  if (toAddress == null) {
    toAddress=node.getMasterAddress();
  }
  return sendProcessableTo(node.createJoinInfo(withCredentials),toAddress);
}

Fixed version (ground truth):
public boolean sendJoinRequest(Address toAddress,boolean withCredentials){
  if (toAddress == null) {
    toAddress=node.getMasterAddress();
  }
  logger.log(Level.INFO,"String_Node_Str" + toAddress);
  final boolean send=sendProcessableTo(node.createJoinInfo(withCredentials),toAddress);
  if (!send) {
    logger.log(Level.WARNING,"String_Node_Str" + toAddress);
  }
  return send;
}
Program: 49449
Project: 49449
Buggy source:
void scheduleHeartbeatTimerTask(){
  final int TIMEOUT=config.getConnectionTimeout();
  heartbeatTimer.schedule(new TimerTask(){
    @Override public void run(){
      long diff=Clock.currentTimeMillis() - client.getInRunnable().lastReceived;
      try {
        if (diff >= TIMEOUT / 5 && diff < TIMEOUT) {
          logger.log(Level.FINEST,"String_Node_Str");
          final CountDownLatch latch=new CountDownLatch(1);
          new Thread(new Runnable(){
            public void run(){
              Set<Member> members=client.getCluster().getMembers();
              if (members != null && members.size() >= 1) {
                latch.countDown();
              }
            }
          }
).start();
          if (!latch.await(10000,TimeUnit.MILLISECONDS)) {
            logger.log(Level.WARNING,"String_Node_Str");
          }
        }
 else         if (diff >= TIMEOUT) {
          logger.log(Level.WARNING,"String_Node_Str" + TIMEOUT / 1000 + "String_Node_Str");
          currentConnection.close();
        }
      }
 catch (      InterruptedException e) {
        return;
      }
catch (      IOException ignored) {
      }
    }
  }
,TIMEOUT / 10,TIMEOUT / 10);
}

Fixed version (ground truth):
void scheduleHeartbeatTimerTask(){
  final int TIMEOUT=config.getConnectionTimeout();
  heartbeatTimer.schedule(new TimerTask(){
    @Override public void run(){
      long diff=Clock.currentTimeMillis() - client.getInRunnable().lastReceived;
      try {
        if (diff >= TIMEOUT / 5 && diff < TIMEOUT) {
          logger.log(Level.FINEST,"String_Node_Str");
          final CountDownLatch latch=new CountDownLatch(1);
          new Thread(new Runnable(){
            public void run(){
              Set<Member> members=client.getCluster().getMembers();
              if (members != null && members.size() >= 1) {
                latch.countDown();
              }
            }
          }
).start();
          if (!latch.await(10000,TimeUnit.MILLISECONDS)) {
            logger.log(Level.WARNING,"String_Node_Str");
          }
        }
 else         if (diff >= TIMEOUT) {
          logger.log(Level.WARNING,"String_Node_Str" + TIMEOUT / 1000 + "String_Node_Str");
          currentConnection.close();
        }
      }
 catch (      InterruptedException e) {
        return;
      }
catch (      IOException ignored) {
      }
    }
  }
,TIMEOUT,TIMEOUT / 10);
}
Program: 49450
Project: 49450
Buggy source:
/** 
 * Returns the default Hazelcast instance, starts it with the default configuration, if not already started.
 * @return the default Hazelcast instance
 * @deprecated as of version 2.2
 * @see #newHazelcastInstance(com.hazelcast.config.Config)
 * @see #getHazelcastInstanceByName(String)
 * @see #getAllHazelcastInstances()
 */
@Deprecated public static HazelcastInstance getDefaultInstance(){
  HazelcastInstance defaultInstanceObject=defaultInstance.get();
  if (defaultInstanceObject == null || !defaultInstanceObject.getLifecycleService().isRunning()) {
synchronized (initLock) {
      defaultInstanceObject=defaultInstance.get();
      if (defaultInstanceObject == null || !defaultInstanceObject.getLifecycleService().isRunning()) {
        defaultInstanceObject=com.hazelcast.impl.FactoryImpl.newHazelcastInstanceProxy(defaultConfig,null);
        defaultInstance.set(defaultInstanceObject);
        return defaultInstanceObject;
      }
 else {
        return defaultInstanceObject;
      }
    }
  }
 else {
    return defaultInstanceObject;
  }
}

Fixed version (ground truth):
/** 
 * Returns the default Hazelcast instance, starts it with the default configuration, if not already started.
 * @return the default Hazelcast instance
 * @deprecated as of version 2.2
 * @see #newHazelcastInstance(com.hazelcast.config.Config)
 * @see #getHazelcastInstanceByName(String)
 * @see #getAllHazelcastInstances()
 */
@Deprecated public static HazelcastInstance getDefaultInstance(){
  HazelcastInstance defaultInstanceObject=defaultInstance.get();
  if (defaultInstanceObject == null || !defaultInstanceObject.getLifecycleService().isRunning()) {
synchronized (initLock) {
      defaultInstanceObject=defaultInstance.get();
      if (defaultInstanceObject == null || !defaultInstanceObject.getLifecycleService().isRunning()) {
        defaultInstanceObject=com.hazelcast.impl.FactoryImpl.newHazelcastInstanceProxy(defaultConfig);
        defaultInstance.set(defaultInstanceObject);
        return defaultInstanceObject;
      }
 else {
        return defaultInstanceObject;
      }
    }
  }
 else {
    return defaultInstanceObject;
  }
}