nus-yam/ex-repair huggingface dataset:
Program: 48061
Project: 48061
Buggy source:
@Test public void testGracefulShutdown() throws Exception {
  int size=50000;
  TestHazelcastInstanceFactory nodeFactory=createHazelcastInstanceFactory(4);
  final Config config=new Config();
  HazelcastInstance h1=nodeFactory.newHazelcastInstance(config);
  IMap m1=h1.getMap(MAP_NAME);
  for (int i=0; i < size; i++) {
    m1.put(i,i);
  }
  HazelcastInstance h2=nodeFactory.newHazelcastInstance(config);
  IMap m2=h2.getMap(MAP_NAME);
  h1.shutdown();
  assertEquals(size,m2.size());
  HazelcastInstance h3=nodeFactory.newHazelcastInstance(config);
  IMap m3=h3.getMap(MAP_NAME);
  h2.shutdown();
  assertEquals(size,m3.size());
  HazelcastInstance h4=nodeFactory.newHazelcastInstance(config);
  IMap m4=h4.getMap(MAP_NAME);
  h3.shutdown();
  assertEquals(size,m4.size());
}

Fixed version (ground truth):
@Test public void testGracefulShutdown() throws Exception {
  int size=50000;
  TestHazelcastInstanceFactory nodeFactory=createHazelcastInstanceFactory(4);
  final Config config=new Config();
  HazelcastInstance h1=nodeFactory.newHazelcastInstance(config);
  IMap<Integer,Integer> m1=h1.getMap(MAP_NAME);
  for (int i=0; i < size; i++) {
    m1.put(i,i);
  }
  HazelcastInstance h2=nodeFactory.newHazelcastInstance(config);
  IMap<Integer,Integer> m2=h2.getMap(MAP_NAME);
  shutdownAndWait(h1);
  waitForMigrationAndCheckSize(size,h2,m2);
  HazelcastInstance h3=nodeFactory.newHazelcastInstance(config);
  IMap<Integer,Integer> m3=h3.getMap(MAP_NAME);
  shutdownAndWait(h2);
  waitForMigrationAndCheckSize(size,h3,m3);
  HazelcastInstance h4=nodeFactory.newHazelcastInstance(config);
  IMap<Integer,Integer> m4=h4.getMap(MAP_NAME);
  shutdownAndWait(h3);
  waitForMigrationAndCheckSize(size,h4,m4);
}
Program: 48062
Project: 48062
Buggy source:
/** 
 * Test for issue #259.
 */
@Test public void testBackupPutWhenOwnerNodeDead() throws InterruptedException {
  final TestHazelcastInstanceFactory nodeFactory=createHazelcastInstanceFactory(2);
  final String name=MAP_NAME;
  final HazelcastInstance hz=nodeFactory.newHazelcastInstance();
  final HazelcastInstance hz2=nodeFactory.newHazelcastInstance();
  final IMap<Object,Object> map=hz2.getMap(name);
  final int size=100000;
  final byte[] data=new byte[250];
  final int threads=100;
  final int l=size / threads;
  final CountDownLatch latch=new CountDownLatch(threads);
  ExecutorService ex=Executors.newFixedThreadPool(threads);
  new Thread(){
    public void run(){
      while (hz.getMap(name).size() < size / 2) {
        try {
          sleep(5);
        }
 catch (        InterruptedException ignored) {
          return;
        }
      }
      TestUtil.terminateInstance(hz);
    }
  }
.start();
  for (int i=0; i < threads; i++) {
    final int n=i;
    ex.execute(new Runnable(){
      public void run(){
        for (int j=(n * l); j < (n + 1) * l; j++) {
          map.put(j,data);
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException ignored) {
            return;
          }
        }
        latch.countDown();
      }
    }
);
  }
  try {
    assertTrue(latch.await(5,TimeUnit.MINUTES));
    assertEquals("String_Node_Str",size,map.size());
  }
  finally {
    ex.shutdownNow();
  }
}

Fixed version (ground truth):
/** 
 * Test for issue #259.
 */
@Test public void testBackupPutWhenOwnerNodeDead() throws InterruptedException {
  final TestHazelcastInstanceFactory nodeFactory=createHazelcastInstanceFactory(2);
  final String name=MAP_NAME;
  final HazelcastInstance hz=nodeFactory.newHazelcastInstance();
  final HazelcastInstance hz2=nodeFactory.newHazelcastInstance();
  final IMap<Integer,byte[]> map=hz2.getMap(name);
  final int size=100000;
  final byte[] data=new byte[250];
  final int threads=100;
  final int l=size / threads;
  final CountDownLatch latch=new CountDownLatch(threads);
  ExecutorService ex=Executors.newFixedThreadPool(threads);
  new Thread(){
    public void run(){
      while (hz.getMap(name).size() < size / 2) {
        try {
          sleep(5);
        }
 catch (        InterruptedException ignored) {
          return;
        }
      }
      TestUtil.terminateInstance(hz);
    }
  }
.start();
  for (int i=0; i < threads; i++) {
    final int n=i;
    ex.execute(new Runnable(){
      public void run(){
        for (int j=(n * l); j < (n + 1) * l; j++) {
          map.put(j,data);
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException ignored) {
            return;
          }
        }
        latch.countDown();
      }
    }
);
  }
  try {
    assertTrue(latch.await(5,TimeUnit.MINUTES));
    assertEquals("String_Node_Str",size,map.size());
  }
  finally {
    ex.shutdownNow();
  }
}
Program: 48064
Project: 48064
Buggy source:
@Test public void testDestroyTopicRemovesStatistics(){
  HazelcastInstance instance=createHazelcastInstance();
  final ITopic topic=instance.getTopic("String_Node_Str");
  topic.publish("String_Node_Str");
  sleepSeconds(1);
  topic.destroy();
  final TopicService topicService=getNode(instance).nodeEngine.getService(TopicService.SERVICE_NAME);
  assertTrueEventually(new AssertTask(){
    @Override public void run(){
      boolean containsStats=topicService.statsMap.containsKey(topic.getName());
      assertFalse(containsStats);
    }
  }
);
}

Fixed version (ground truth):
@Test public void testDestroyTopicRemovesStatistics(){
  HazelcastInstance instance=createHazelcastInstance();
  final ITopic topic=instance.getTopic("String_Node_Str");
  topic.publish("String_Node_Str");
  sleepSeconds(1);
  topic.destroy();
  final TopicService topicService=getNode(instance).nodeEngine.getService(TopicService.SERVICE_NAME);
  assertTrueEventually(new AssertTask(){
    @Override public void run(){
      boolean containsStats=topicService.getStatsMap().containsKey(topic.getName());
      assertFalse(containsStats);
    }
  }
);
}
Program: 48065
Project: 48065
Buggy source:
@PrivateApi public static <V>Collection<V> returnWithDeadline(Collection<Future> futures,long overallTimeout,TimeUnit overallTimeUnit,long perFutureTimeout,TimeUnit perFutureTimeUnit,ExceptionHandler exceptionHandler) throws TimeoutException {
  long overallTimeoutNanos=calculateTimeout(overallTimeout,overallTimeUnit);
  long perFutureTimeoutNanos=calculateTimeout(perFutureTimeout,perFutureTimeUnit);
  long deadline=System.nanoTime() + overallTimeoutNanos;
  List<V> results=new ArrayList<V>(futures.size());
  for (  Future<V> future : futures) {
    try {
      long timeoutNanos=calculateFutureTimeout(perFutureTimeoutNanos,deadline);
      V value=executeWithDeadline(future,timeoutNanos,exceptionHandler);
      if (value != null) {
        results.add(value);
      }
    }
 catch (    TimeoutException e) {
      if (deadline - System.nanoTime() <= 0) {
        cancelAllFutures(futures);
        throw (TimeoutException)e;
      }
    }
catch (    Exception e) {
      cancelAllFutures(futures);
      ExceptionUtil.sneakyThrow(e);
    }
  }
  return results;
}

Fixed version (ground truth):
@PrivateApi public static <V>Collection<V> returnWithDeadline(Collection<Future> futures,long overallTimeout,TimeUnit overallTimeUnit,long perFutureTimeout,TimeUnit perFutureTimeUnit,ExceptionHandler exceptionHandler) throws TimeoutException {
  long overallTimeoutNanos=calculateTimeout(overallTimeout,overallTimeUnit);
  long perFutureTimeoutNanos=calculateTimeout(perFutureTimeout,perFutureTimeUnit);
  long deadline=System.nanoTime() + overallTimeoutNanos;
  List<V> results=new ArrayList<V>(futures.size());
  for (  Future<V> future : futures) {
    try {
      long timeoutNanos=calculateFutureTimeout(perFutureTimeoutNanos,deadline);
      V value=executeWithDeadline(future,timeoutNanos,exceptionHandler);
      if (value != null) {
        results.add(value);
      }
    }
 catch (    TimeoutException e) {
      cancelAllFutures(futures);
      throw (TimeoutException)e;
    }
catch (    RuntimeException e) {
      cancelAllFutures(futures);
      throw (RuntimeException)e;
    }
catch (    Exception e) {
      cancelAllFutures(futures);
      throw new RuntimeException(e);
    }
  }
  return results;
}
Program: 48066
Project: 48066
Buggy source:
@PrivateApi public static void waitWithDeadline(Collection<Future> futures,long overallTimeout,TimeUnit overallTimeUnit,long perFutureTimeout,TimeUnit perFutureTimeUnit,ExceptionHandler exceptionHandler) throws TimeoutException {
  long overallTimeoutNanos=calculateTimeout(overallTimeout,overallTimeUnit);
  long perFutureTimeoutNanos=calculateTimeout(perFutureTimeout,perFutureTimeUnit);
  long deadline=System.nanoTime() + overallTimeoutNanos;
  for (  Future future : futures) {
    try {
      long timeoutNanos=calculateFutureTimeout(perFutureTimeoutNanos,deadline);
      executeWithDeadline(future,timeoutNanos,exceptionHandler);
    }
 catch (    TimeoutException e) {
      if (deadline - System.nanoTime() <= 0) {
        cancelAllFutures(futures);
        throw (TimeoutException)e;
      }
    }
catch (    Exception e) {
      cancelAllFutures(futures);
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@PrivateApi public static void waitWithDeadline(Collection<Future> futures,long overallTimeout,TimeUnit overallTimeUnit,long perFutureTimeout,TimeUnit perFutureTimeUnit,ExceptionHandler exceptionHandler) throws TimeoutException {
  long overallTimeoutNanos=calculateTimeout(overallTimeout,overallTimeUnit);
  long perFutureTimeoutNanos=calculateTimeout(perFutureTimeout,perFutureTimeUnit);
  long deadline=System.nanoTime() + overallTimeoutNanos;
  for (  Future future : futures) {
    try {
      long timeoutNanos=calculateFutureTimeout(perFutureTimeoutNanos,deadline);
      executeWithDeadline(future,timeoutNanos,exceptionHandler);
    }
 catch (    TimeoutException e) {
      cancelAllFutures(futures);
      throw (TimeoutException)e;
    }
catch (    RuntimeException e) {
      cancelAllFutures(futures);
      throw (RuntimeException)e;
    }
catch (    Exception e) {
      cancelAllFutures(futures);
      throw new RuntimeException(e);
    }
  }
}
Program: 48067
Project: 48067
Buggy source:
@Override public void run(){
  if (waitLock.compareAndSet(true,false)) {
    try {
      for (; ; ) {
        Thread.sleep(100);
      }
    }
 catch (    InterruptedException ignored) {
      interrupted.set(true);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  long start=System.nanoTime();
  if (waitLock.compareAndSet(true,false)) {
    try {
      for (; ; ) {
        Thread.sleep(100);
      }
    }
 catch (    InterruptedException ignored) {
      deltaToInterrupted.set(System.nanoTime() - start);
      interrupted.set(true);
    }
  }
}
Program: 48068
Project: 48068
Buggy source:
@Test @Category(NightlyTest.class) public void testIssue1085EvictionBackup() throws InterruptedException {
  Config config=new Config();
  config.getMapConfig("String_Node_Str").setTimeToLiveSeconds(3);
  HazelcastInstance[] instances=createHazelcastInstanceFactory(3).newInstances(config);
  int size=1000;
  final CountDownLatch latch=new CountDownLatch(size);
  final IMap map=instances[0].getMap("String_Node_Str");
  map.addEntryListener(new EntryAdapter(){
    @Override public void entryEvicted(    EntryEvent event){
      super.entryEvicted(event);
      latch.countDown();
    }
  }
,false);
  for (int i=0; i < size; i++) {
    map.put(i,i);
  }
  instances[1].shutdown();
  instances[2].shutdown();
  assertOpenEventually(latch);
  assertSizeEventually(0,map);
}

Fixed version (ground truth):
@Test public void testIssue1085EvictionBackup() throws InterruptedException {
  final String mapName=randomMapName();
  int entryCount=10;
  Config config=new Config();
  config.getMapConfig(mapName).setTimeToLiveSeconds(3);
  HazelcastInstance[] instances=createHazelcastInstanceFactory(2).newInstances(config);
  final CountDownLatch latch=new CountDownLatch(entryCount);
  final IMap map=instances[0].getMap(mapName);
  map.addEntryListener(new EntryAdapter(){
    @Override public void entryEvicted(    EntryEvent event){
      super.entryEvicted(event);
      latch.countDown();
    }
  }
,false);
  for (int i=0; i < entryCount; i++) {
    map.put(i,i);
  }
  assertOpenEventually(latch);
  assertSizeEventually(0,map);
  assertHeapCostsZeroEventually(mapName,instances);
}
Program: 48069
Project: 48069
Buggy source:
@Override public QueryResult queryOnPartition(String mapName,Predicate predicate,int partitionId){
  final QueryResult result=new QueryResult();
  final PartitionContainer container=mapServiceContext.getPartitionContainer(partitionId);
  final RecordStore recordStore=container.getRecordStore(mapName);
  final SerializationService serializationService=nodeEngine.getSerializationService();
  final PagingPredicate pagingPredicate=predicate instanceof PagingPredicate ? (PagingPredicate)predicate : null;
  List<QueryEntry> list=new LinkedList<QueryEntry>();
  final Iterator<Record> iterator=recordStore.loadAwareIterator();
  while (iterator.hasNext()) {
    final Record record=iterator.next();
    Data key=record.getKey();
    Object value=record.getValue();
    if (value == null) {
      continue;
    }
    QueryEntry queryEntry=new QueryEntry(serializationService,key,key,value);
    if (predicate.apply(queryEntry)) {
      if (pagingPredicate != null) {
        Map.Entry anchor=pagingPredicate.getAnchor();
        if (anchor != null && SortingUtil.compare(pagingPredicate.getComparator(),pagingPredicate.getIterationType(),anchor,queryEntry) >= 0) {
          continue;
        }
      }
      list.add(queryEntry);
    }
  }
  list=getPage(list,pagingPredicate);
  for (  QueryEntry entry : list) {
    result.add(new QueryResultEntryImpl(entry.getKeyData(),entry.getKeyData(),entry.getValueData()));
  }
  return result;
}

Fixed version (ground truth):
@Override public Collection<QueryableEntry> queryOnPartition(String mapName,Predicate predicate,int partitionId){
  final PartitionContainer container=mapServiceContext.getPartitionContainer(partitionId);
  final RecordStore recordStore=container.getRecordStore(mapName);
  final SerializationService serializationService=nodeEngine.getSerializationService();
  final PagingPredicate pagingPredicate=predicate instanceof PagingPredicate ? (PagingPredicate)predicate : null;
  List<QueryEntry> list=new LinkedList<QueryEntry>();
  final Iterator<Record> iterator=recordStore.loadAwareIterator();
  while (iterator.hasNext()) {
    final Record record=iterator.next();
    Data key=record.getKey();
    Object value=getValueOrCachedValue(record);
    if (value == null) {
      continue;
    }
    QueryEntry queryEntry=new QueryEntry(serializationService,key,key,value);
    if (predicate.apply(queryEntry)) {
      if (pagingPredicate != null) {
        Map.Entry anchor=pagingPredicate.getAnchor();
        if (anchor != null && SortingUtil.compare(pagingPredicate.getComparator(),pagingPredicate.getIterationType(),anchor,queryEntry) >= 0) {
          continue;
        }
      }
      list.add(queryEntry);
    }
  }
  return getPage(list,pagingPredicate);
}
Program: 48070
Project: 48070
Buggy source:
/** 
 * Query a specific partition.
 * @param mapName     map name.
 * @param predicate   any predicate.
 * @param partitionId partition id.
 * @return {@link com.hazelcast.map.QueryResult}
 */
QueryResult queryOnPartition(String mapName,Predicate predicate,int partitionId);

Fixed version (ground truth):
/** 
 * Query a specific partition.
 * @param mapName     map name.
 * @param predicate   any predicate.
 * @param partitionId partition id.
 * @return result of query
 */
Collection<QueryableEntry> queryOnPartition(String mapName,Predicate predicate,int partitionId);
Program: 48071
Project: 48071
Buggy source:
public Set<QueryResultEntry> getResult(){
  return result;
}

Fixed version (ground truth):
public Collection<QueryResultEntry> getResult(){
  return result;
}
Program: 48072
Project: 48072
Buggy source:
public Collection<QueryableEntry> call() throws Exception {
  final PartitionContainer container=mapService.getMapServiceContext().getPartitionContainer(partition);
  final RecordStore recordStore=container.getRecordStore(name);
  LinkedList<QueryableEntry> partitionResult=new LinkedList<QueryableEntry>();
  final Iterator<Record> iterator=recordStore.loadAwareIterator();
  while (iterator.hasNext()) {
    final Record record=iterator.next();
    final Data key=record.getKey();
    final Object value=getValueOrCachedValue(record);
    if (value == null) {
      continue;
    }
    final QueryEntry queryEntry=new QueryEntry(ss,key,key,value);
    if (predicate.apply(queryEntry)) {
      if (pagingPredicate != null) {
        Map.Entry anchor=pagingPredicate.getAnchor();
        final Comparator comparator=pagingPredicate.getComparator();
        if (anchor != null && SortingUtil.compare(comparator,pagingPredicate.getIterationType(),anchor,queryEntry) >= 0) {
          continue;
        }
      }
      partitionResult.add(queryEntry);
    }
  }
  if (pagingPredicate != null) {
    Collections.sort(partitionResult,wrapperComparator);
    if (partitionResult.size() > pagingPredicate.getPageSize()) {
      return partitionResult.subList(0,pagingPredicate.getPageSize());
    }
  }
  return partitionResult;
}

Fixed version (ground truth):
public Collection<QueryableEntry> call() throws Exception {
  MapContextQuerySupport mapContextQuerySupport=mapService.getMapServiceContext().getMapContextQuerySupport();
  return mapContextQuerySupport.queryOnPartition(name,predicate,partition);
}
Program: 48073
Project: 48073
Buggy source:
protected void runParallelForPaging(List<Integer> initialPartitions) throws InterruptedException, ExecutionException {
  final NodeEngine nodeEngine=getNodeEngine();
  final SerializationService ss=nodeEngine.getSerializationService();
  final ExecutorService executor=nodeEngine.getExecutionService().getExecutor(ExecutionService.QUERY_EXECUTOR);
  final List<Future<Collection<QueryableEntry>>> lsFutures=new ArrayList<Future<Collection<QueryableEntry>>>(initialPartitions.size());
  final Comparator<Map.Entry> wrapperComparator=SortingUtil.newComparator(pagingPredicate);
  for (  final Integer partition : initialPartitions) {
    Future<Collection<QueryableEntry>> f=executor.submit(new PartitionCallable(ss,partition,wrapperComparator));
    lsFutures.add(f);
  }
  List<QueryableEntry> toMerge=new LinkedList<QueryableEntry>();
  for (  Future<Collection<QueryableEntry>> future : lsFutures) {
    final Collection<QueryableEntry> collection=future.get();
    toMerge.addAll(collection);
  }
  Collections.sort(toMerge,wrapperComparator);
  if (toMerge.size() > pagingPredicate.getPageSize()) {
    toMerge=toMerge.subList(0,pagingPredicate.getPageSize());
  }
  for (  QueryableEntry entry : toMerge) {
    result.add(new QueryResultEntryImpl(entry.getKeyData(),entry.getKeyData(),entry.getValueData()));
  }
}

Fixed version (ground truth):
protected void runParallelForPaging(List<Integer> initialPartitions) throws InterruptedException, ExecutionException {
  final NodeEngine nodeEngine=getNodeEngine();
  final ExecutorService executor=nodeEngine.getExecutionService().getExecutor(ExecutionService.QUERY_EXECUTOR);
  final List<Future<Collection<QueryableEntry>>> lsFutures=new ArrayList<Future<Collection<QueryableEntry>>>(initialPartitions.size());
  final Comparator<Map.Entry> wrapperComparator=SortingUtil.newComparator(pagingPredicate);
  for (  final Integer partitionId : initialPartitions) {
    Future<Collection<QueryableEntry>> f=executor.submit(new PartitionCallable(partitionId));
    lsFutures.add(f);
  }
  List<QueryableEntry> toMerge=new LinkedList<QueryableEntry>();
  for (  Future<Collection<QueryableEntry>> future : lsFutures) {
    final Collection<QueryableEntry> collection=future.get();
    toMerge.addAll(collection);
  }
  Collections.sort(toMerge,wrapperComparator);
  if (toMerge.size() > pagingPredicate.getPageSize()) {
    toMerge=toMerge.subList(0,pagingPredicate.getPageSize());
  }
  for (  QueryableEntry entry : toMerge) {
    result.add(new QueryResultEntryImpl(entry.getKeyData(),entry.getKeyData(),entry.getValueData()));
  }
}
Program: 48074
Project: 48074
Buggy source:
private PartitionCallable(SerializationService ss,int partition,Comparator<Map.Entry> wrapperComparator){
  this.ss=ss;
  this.partition=partition;
  this.wrapperComparator=wrapperComparator;
}

Fixed version (ground truth):
private PartitionCallable(int partitionId){
  this.partition=partitionId;
}
Program: 48075
Project: 48075
Buggy source:
protected void runParallel(final List<Integer> initialPartitions) throws InterruptedException, ExecutionException {
  final NodeEngine nodeEngine=getNodeEngine();
  final SerializationService ss=nodeEngine.getSerializationService();
  final ExecutorService executor=nodeEngine.getExecutionService().getExecutor(ExecutionService.QUERY_EXECUTOR);
  final List<Future<Collection<QueryableEntry>>> lsFutures=new ArrayList<Future<Collection<QueryableEntry>>>(initialPartitions.size());
  for (  final Integer partition : initialPartitions) {
    Future<Collection<QueryableEntry>> f=executor.submit(new PartitionCallable(ss,partition,null));
    lsFutures.add(f);
  }
  for (  Future<Collection<QueryableEntry>> future : lsFutures) {
    final Collection<QueryableEntry> collection=future.get();
    if (collection != null) {
      for (      QueryableEntry entry : collection) {
        result.add(new QueryResultEntryImpl(entry.getKeyData(),entry.getKeyData(),entry.getValueData()));
      }
    }
  }
}

Fixed version (ground truth):
protected void runParallel(final List<Integer> initialPartitions) throws InterruptedException, ExecutionException {
  final NodeEngine nodeEngine=getNodeEngine();
  final ExecutorService executor=nodeEngine.getExecutionService().getExecutor(ExecutionService.QUERY_EXECUTOR);
  final List<Future<Collection<QueryableEntry>>> lsFutures=new ArrayList<Future<Collection<QueryableEntry>>>(initialPartitions.size());
  for (  Integer partitionId : initialPartitions) {
    Future<Collection<QueryableEntry>> f=executor.submit(new PartitionCallable(partitionId));
    lsFutures.add(f);
  }
  for (  Future<Collection<QueryableEntry>> future : lsFutures) {
    final Collection<QueryableEntry> collection=future.get();
    if (collection != null) {
      for (      QueryableEntry entry : collection) {
        result.add(new QueryResultEntryImpl(entry.getKeyData(),entry.getKeyData(),entry.getValueData()));
      }
    }
  }
}
Program: 48076
Project: 48076
Buggy source:
public void run(){
  result=mapService.getMapServiceContext().getMapContextQuerySupport().queryOnPartition(name,predicate,getPartitionId());
}

Fixed version (ground truth):
public void run(){
  Collection<QueryableEntry> queryableEntries=mapService.getMapServiceContext().getMapContextQuerySupport().queryOnPartition(name,predicate,getPartitionId());
  result=new QueryResult(queryableEntries);
}
Program: 48077
Project: 48077
Buggy source:
private void advance(){
  while (iterator.hasNext()) {
    nextRecord=iterator.next();
    nextRecord=nullIfExpired(nextRecord);
    if (nextRecord != null) {
      break;
    }
  }
}

Fixed version (ground truth):
private void advance(){
  while (iterator.hasNext()) {
    nextRecord=iterator.next();
    nextRecord=nullIfExpired(nextRecord);
    if (nextRecord != null) {
      return;
    }
  }
  nextRecord=null;
}
Program: 48078
Project: 48078
Buggy source:
private MultiExecutionCallbackWrapper(final int memberSize,final MultiExecutionCallback multiExecutionCallback){
  this.multiExecutionCallback=multiExecutionCallback;
  this.values=new HashMap<Member,Object>(memberSize);
  this.members=new AtomicInteger(memberSize);
}

Fixed version (ground truth):
private MultiExecutionCallbackWrapper(final int memberSize,final MultiExecutionCallback multiExecutionCallback){
  this.multiExecutionCallback=multiExecutionCallback;
  this.values=new ConcurrentHashMap<Member,Object>(memberSize);
  this.members=new AtomicInteger(memberSize);
}
Program: 48079
Project: 48079
Buggy source:
/** 
 * fails randomly. Example stack trace is here: https://hazelcast-l337.ci.cloudbees.com/job/Hazelcast-3.x-OpenJDK7/com.hazelcast$hazelcast-client/133/testReport/com.hazelcast.client.executor/ClientExecutorServiceSubmitTest/submitCallableToMember_withMultiExecutionCallback/
 */
@Test @Category(ProblematicTest.class) public void submitCallableToMember_withMultiExecutionCallback() throws Exception {
  final IExecutorService service=client.getExecutorService(randomString());
  final CountDownLatch responseLatch=new CountDownLatch(CLUSTER_SIZE);
  final CountDownLatch completeLatch=new CountDownLatch(CLUSTER_SIZE);
  final String msg=randomString();
  final Callable callable=new AppendCallable(msg);
  final Collection<Member> collection=instance2.getCluster().getMembers();
  service.submitToMembers(callable,collection,new MultiExecutionCallback(){
    public void onResponse(    final Member member,    final Object value){
      if (value.equals(msg + AppendCallable.APPENDAGE)) {
        responseLatch.countDown();
      }
    }
    public void onComplete(    final Map<Member,Object> values){
      for (      final Member member : values.keySet()) {
        final Object value=values.get(member);
        if (value.equals(msg + AppendCallable.APPENDAGE)) {
          completeLatch.countDown();
        }
      }
    }
  }
);
  assertOpenEventually("String_Node_Str",responseLatch);
  assertOpenEventually("String_Node_Str",completeLatch);
}

Fixed version (ground truth):
@Test public void submitCallableToMember_withMultiExecutionCallback() throws Exception {
  final IExecutorService service=client.getExecutorService(randomString());
  final CountDownLatch responseLatch=new CountDownLatch(CLUSTER_SIZE);
  final CountDownLatch completeLatch=new CountDownLatch(CLUSTER_SIZE);
  final String msg=randomString();
  final Callable<String> callable=new AppendCallable(msg);
  final Collection<Member> collection=instance2.getCluster().getMembers();
  service.submitToMembers(callable,collection,new MultiExecutionCallback(){
    public void onResponse(    final Member member,    final Object value){
      if (value.equals(msg + AppendCallable.APPENDAGE)) {
        responseLatch.countDown();
      }
    }
    public void onComplete(    final Map<Member,Object> values){
      for (      final Member member : values.keySet()) {
        final Object value=values.get(member);
        if (value.equals(msg + AppendCallable.APPENDAGE)) {
          completeLatch.countDown();
        }
      }
    }
  }
);
  assertOpenEventually("String_Node_Str",responseLatch);
  assertOpenEventually("String_Node_Str",completeLatch);
}
Program: 48080
Project: 48080
Buggy source:
@Override public <T>void submitToAllMembers(Callable<T> task,MultiExecutionCallback callback){
  final Collection<MemberImpl> memberList=getContext().getClusterService().getMemberList();
  MultiExecutionCallbackWrapper multiExecutionCallbackWrapper=new MultiExecutionCallbackWrapper(memberList.size(),callback);
  for (  Member member : memberList) {
    final ExecutionCallbackWrapper executionCallback=new ExecutionCallbackWrapper(multiExecutionCallbackWrapper,member);
    submitToMember(task,member,executionCallback);
  }
}

Fixed version (ground truth):
@Override public <T>void submitToAllMembers(Callable<T> task,MultiExecutionCallback callback){
  final Collection<MemberImpl> memberList=getContext().getClusterService().getMemberList();
  MultiExecutionCallbackWrapper multiExecutionCallbackWrapper=new MultiExecutionCallbackWrapper(memberList.size(),callback);
  for (  Member member : memberList) {
    final ExecutionCallbackWrapper<T> executionCallback=new ExecutionCallbackWrapper<T>(multiExecutionCallbackWrapper,member);
    submitToMember(task,member,executionCallback);
  }
}
Program: 48081
Project: 48081
Buggy source:
public void onResponse(Member member,Object value){
  multiExecutionCallback.onResponse(member,value);
  values.put(member,value);
  int waitingResponse=members.decrementAndGet();
  if (waitingResponse == 0) {
    onComplete(values);
  }
}

Fixed version (ground truth):
public void onResponse(final Member member,final Object value){
  multiExecutionCallback.onResponse(member,value);
  values.put(member,value);
  int waitingResponse=members.decrementAndGet();
  if (waitingResponse == 0) {
    onComplete(values);
  }
}
Program: 48082
Project: 48082
Buggy source:
private MultiExecutionCallbackWrapper(int memberSize,MultiExecutionCallback multiExecutionCallback){
  this.multiExecutionCallback=multiExecutionCallback;
  this.members=new AtomicInteger(memberSize);
  values=new HashMap<Member,Object>(memberSize);
}

Fixed version (ground truth):
private MultiExecutionCallbackWrapper(final int memberSize,final MultiExecutionCallback multiExecutionCallback){
  this.multiExecutionCallback=multiExecutionCallback;
  this.values=new HashMap<Member,Object>(memberSize);
  this.members=new AtomicInteger(memberSize);
}
Program: 48083
Project: 48083
Buggy source:
public void onComplete(Map<Member,Object> values){
  multiExecutionCallback.onComplete(values);
}

Fixed version (ground truth):
public void onComplete(final Map<Member,Object> values){
  multiExecutionCallback.onComplete(values);
}
Program: 48084
Project: 48084
Buggy source:
private ICompletableFuture invokeFuture(TargetCallableRequest request){
  try {
    return getContext().getInvocationService().invokeOnTarget(request,request.getTarget());
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e);
  }
}

Fixed version (ground truth):
private <T>ICompletableFuture<T> invokeFuture(TargetCallableRequest request){
  try {
    return getContext().getInvocationService().invokeOnTarget(request,request.getTarget());
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 48085
Project: 48085
Buggy source:
public boolean isShutdown(){
  try {
    final IsShutdownRequest request=new IsShutdownRequest(name);
    Boolean result=invoke(request);
    return result;
  }
 catch (  DistributedObjectDestroyedException e) {
    return true;
  }
}

Fixed version (ground truth):
public boolean isShutdown(){
  try {
    final IsShutdownRequest request=new IsShutdownRequest(name);
    return (Boolean)invoke(request);
  }
 catch (  DistributedObjectDestroyedException e) {
    return true;
  }
}
Program: 48086
Project: 48086
Buggy source:
@Test public void testExecuteOnMembers(){
  final IExecutorService service=client.getExecutorService(randomString());
  final String mapName=randomString();
  final Collection collection=new ArrayList();
  final Member member1=instance1.getCluster().getLocalMember();
  final Member member3=instance3.getCluster().getLocalMember();
  collection.add(member1);
  collection.add(member3);
  service.executeOnMembers(new MapPutRunnable(mapName),collection);
  final IMap map=client.getMap(mapName);
  assertTrueEventually(new AssertTask(){
    public void run() throws Exception {
      assertTrue(map.containsKey(member1.getUuid()));
      assertTrue(map.containsKey(member3.getUuid()));
    }
  }
);
}

Fixed version (ground truth):
@Test public void testExecuteOnMembers(){
  final IExecutorService service=client.getExecutorService(randomString());
  final String mapName=randomString();
  final Collection<Member> collection=new ArrayList<Member>();
  final Member member1=instance1.getCluster().getLocalMember();
  final Member member3=instance3.getCluster().getLocalMember();
  collection.add(member1);
  collection.add(member3);
  service.executeOnMembers(new MapPutRunnable(mapName),collection);
  final IMap map=client.getMap(mapName);
  assertTrueEventually(new AssertTask(){
    public void run() throws Exception {
      assertTrue(map.containsKey(member1.getUuid()));
      assertTrue(map.containsKey(member3.getUuid()));
    }
  }
);
}
Program: 48087
Project: 48087
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testExecuteOnMembers_whenSelectorNull(){
  IExecutorService service=client.getExecutorService(randomString());
  MemberSelector selector=null;
  service.executeOnMembers(new MapPutRunnable("String_Node_Str"),selector);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testExecuteOnMembers_whenSelectorNull(){
  final IExecutorService service=client.getExecutorService(randomString());
  final MemberSelector selector=null;
  service.executeOnMembers(new MapPutRunnable("String_Node_Str"),selector);
}
Program: 48088
Project: 48088
Buggy source:
@Test public void testExecuteOnMembers_withEmptyCollection(){
  final IExecutorService service=client.getExecutorService(randomString());
  final String mapName=randomString();
  final Collection collection=new ArrayList();
  service.executeOnMembers(new MapPutRunnable(mapName),collection);
  final IMap map=client.getMap(mapName);
  assertSizeEventually(0,map);
}

Fixed version (ground truth):
@Test public void testExecuteOnMembers_withEmptyCollection(){
  final IExecutorService service=client.getExecutorService(randomString());
  final String mapName=randomString();
  final Collection<Member> collection=new ArrayList<Member>();
  service.executeOnMembers(new MapPutRunnable(mapName),collection);
  final IMap map=client.getMap(mapName);
  assertSizeEventually(0,map);
}
Program: 48089
Project: 48089
Buggy source:
@Test(expected=NullPointerException.class) public void testExecuteOnMembers_WhenCollectionNull(){
  IExecutorService service=client.getExecutorService(randomString());
  Collection collection=null;
  service.executeOnMembers(new MapPutRunnable("String_Node_Str"),collection);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testExecuteOnMembers_WhenCollectionNull(){
  final IExecutorService service=client.getExecutorService(randomString());
  final Collection<Member> collection=null;
  service.executeOnMembers(new MapPutRunnable("String_Node_Str"),collection);
}
Program: 48090
Project: 48090
Buggy source:
@Test(expected=NullPointerException.class) public void testExecute_whenTaskNull(){
  IExecutorService service=client.getExecutorService(randomString());
  service.execute(null);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testExecute_whenTaskNull(){
  final IExecutorService service=client.getExecutorService(randomString());
  service.execute(null);
}
Program: 48091
Project: 48091
Buggy source:
@Test(expected=UnsupportedOperationException.class) public void testInvokeAll_withTimeOut() throws Throwable {
  IExecutorService service=client.getExecutorService(randomString());
  Collection c=new ArrayList();
  c.add(new AppendCallable());
  c.add(new AppendCallable());
  service.invokeAll(c,1,TimeUnit.MINUTES);
}

Fixed version (ground truth):
@Test(expected=UnsupportedOperationException.class) public void testInvokeAll_withTimeOut() throws Throwable {
  final IExecutorService service=client.getExecutorService(randomString());
  final Collection<Callable<String>> collection=new ArrayList<Callable<String>>();
  collection.add(new AppendCallable());
  collection.add(new AppendCallable());
  service.invokeAll(collection,1,TimeUnit.MINUTES);
}
Program: 48092
Project: 48092
Buggy source:
@Test(expected=UnsupportedOperationException.class) public void testInvokeAnyTimeOut() throws Throwable, InterruptedException {
  IExecutorService service=client.getExecutorService(randomString());
  Collection c=new ArrayList();
  c.add(new AppendCallable());
  c.add(new AppendCallable());
  service.invokeAny(c,1,TimeUnit.MINUTES);
}

Fixed version (ground truth):
@Test(expected=UnsupportedOperationException.class) public void testInvokeAnyTimeOut() throws Throwable {
  final IExecutorService service=client.getExecutorService(randomString());
  final Collection<Callable<String>> collection=new ArrayList<Callable<String>>();
  collection.add(new AppendCallable());
  collection.add(new AppendCallable());
  service.invokeAny(collection,1,TimeUnit.MINUTES);
}
Program: 48093
Project: 48093
Buggy source:
@Test(expected=UnsupportedOperationException.class) public void testInvokeAny() throws Throwable, InterruptedException {
  IExecutorService service=client.getExecutorService(randomString());
  Collection c=new ArrayList();
  c.add(new AppendCallable());
  c.add(new AppendCallable());
  service.invokeAny(c);
}

Fixed version (ground truth):
@Test(expected=UnsupportedOperationException.class) public void testInvokeAny() throws Throwable {
  final IExecutorService service=client.getExecutorService(randomString());
  final Collection<Callable<String>> collection=new ArrayList<Callable<String>>();
  collection.add(new AppendCallable());
  collection.add(new AppendCallable());
  service.invokeAny(collection);
}
Program: 48094
Project: 48094
Buggy source:
@Test public void testInvokeAll() throws Throwable {
  IExecutorService service=client.getExecutorService(randomString());
  String msg=randomString();
  Collection c=new ArrayList();
  c.add(new AppendCallable(msg));
  c.add(new AppendCallable(msg));
  List<Future> results=service.invokeAll(c);
  for (  Future result : results) {
    assertEquals(msg + AppendCallable.APPENDAGE,result.get());
  }
}

Fixed version (ground truth):
@Test public void testInvokeAll() throws Throwable {
  final IExecutorService service=client.getExecutorService(randomString());
  final String msg=randomString();
  final Collection<Callable<String>> collection=new ArrayList<Callable<String>>();
  collection.add(new AppendCallable(msg));
  collection.add(new AppendCallable(msg));
  final List<Future<String>> results=service.invokeAll(collection);
  for (  final Future<String> result : results) {
    assertEquals(msg + AppendCallable.APPENDAGE,result.get());
  }
}
Program: 48096
Project: 48096
Buggy source:
void processPartitionRuntimeState(PartitionRuntimeState partitionState){
  lock.lock();
  try {
    if (!node.isActive() || !node.joined()) {
      if (logger.isFinestEnabled()) {
        logger.finest("String_Node_Str" + node.isActive() + "String_Node_Str"+ node.joined()+ "String_Node_Str");
      }
      return;
    }
    final Address sender=partitionState.getEndpoint();
    final Address master=node.getMasterAddress();
    if (node.isMaster()) {
      logger.warning("String_Node_Str" + sender + "String_Node_Str");
      return;
    }
 else {
      if (sender == null || !sender.equals(master)) {
        if (node.clusterService.getMember(sender) == null) {
          logger.severe("String_Node_Str" + "String_Node_Str" + sender + "String_Node_Str"+ master+ "String_Node_Str");
          return;
        }
 else {
          logger.warning("String_Node_Str" + "String_Node_Str" + sender + "String_Node_Str"+ master+ "String_Node_Str"+ "String_Node_Str");
        }
      }
    }
    PartitionInfo[] state=partitionState.getPartitions();
    filterAndLogUnknownAddressesInPartitionTable(sender,state);
    finalizeOrRollbackMigration(partitionState,state);
    stateVersion.set(partitionState.getVersion());
    initialized=true;
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
void processPartitionRuntimeState(PartitionRuntimeState partitionState){
  lock.lock();
  try {
    if (!node.isActive() || !node.joined()) {
      if (logger.isFinestEnabled()) {
        logger.finest("String_Node_Str" + node.isActive() + "String_Node_Str"+ node.joined()+ "String_Node_Str");
      }
      return;
    }
    final Address sender=partitionState.getEndpoint();
    final Address master=node.getMasterAddress();
    if (node.isMaster()) {
      logger.warning("String_Node_Str" + sender + "String_Node_Str");
      return;
    }
 else {
      if (sender == null || !sender.equals(master)) {
        if (node.clusterService.getMember(sender) == null) {
          logger.severe("String_Node_Str" + "String_Node_Str" + sender + "String_Node_Str"+ master+ "String_Node_Str");
          return;
        }
 else {
          logger.warning("String_Node_Str" + "String_Node_Str" + sender + "String_Node_Str"+ master+ "String_Node_Str"+ "String_Node_Str");
        }
      }
    }
    stateVersion.set(partitionState.getVersion());
    initialized=true;
    PartitionInfo[] state=partitionState.getPartitions();
    filterAndLogUnknownAddressesInPartitionTable(sender,state);
    finalizeOrRollbackMigration(partitionState,state);
  }
  finally {
    lock.unlock();
  }
}
Program: 48097
Project: 48097
Buggy source:
private boolean checkReplicaSyncState(){
  if (!initialized || !node.joined()) {
    return true;
  }
  if (getMemberGroupsSize() < 2) {
    return true;
  }
  final Address thisAddress=node.getThisAddress();
  final Semaphore s=new Semaphore(0);
  final AtomicBoolean ok=new AtomicBoolean(true);
  final Callback<Object> callback=new Callback<Object>(){
    @Override public void notify(    Object object){
      if (Boolean.FALSE.equals(object)) {
        ok.compareAndSet(true,false);
      }
 else       if (object instanceof Throwable) {
        ok.compareAndSet(true,false);
      }
      s.release();
    }
  }
;
  int notOwnedCount=syncReplicaVersion(thisAddress,s,ok,callback);
  s.release(notOwnedCount);
  try {
    if (ok.get()) {
      return s.tryAcquire(partitionCount,DEFAULT_SLEEP_MILLIS,TimeUnit.SECONDS) && ok.get();
    }
 else {
      return false;
    }
  }
 catch (  InterruptedException ignored) {
    return false;
  }
}

Fixed version (ground truth):
private boolean checkReplicaSyncState(){
  if (!initialized) {
    return true;
  }
  if (getMemberGroupsSize() < 2) {
    return true;
  }
  final Address thisAddress=node.getThisAddress();
  final Semaphore s=new Semaphore(0);
  final AtomicBoolean ok=new AtomicBoolean(true);
  final Callback<Object> callback=new Callback<Object>(){
    @Override public void notify(    Object object){
      if (Boolean.FALSE.equals(object)) {
        ok.compareAndSet(true,false);
      }
 else       if (object instanceof Throwable) {
        ok.compareAndSet(true,false);
      }
      s.release();
    }
  }
;
  int notOwnedCount=syncReplicaVersion(thisAddress,s,ok,callback);
  s.release(notOwnedCount);
  try {
    if (ok.get()) {
      return s.tryAcquire(partitionCount,DEFAULT_SLEEP_MILLIS,TimeUnit.SECONDS) && ok.get();
    }
 else {
      return false;
    }
  }
 catch (  InterruptedException ignored) {
    return false;
  }
}
Program: 48098
Project: 48098
Buggy source:
@Override public boolean prepareToSafeShutdown(long timeout,TimeUnit unit){
  long timeoutInMillis=unit.toMillis(timeout);
  int sleep=DEFAULT_PAUSE_MILLIS;
  while (timeoutInMillis > 0) {
    while (timeoutInMillis > 0 && shouldWaitMigrationOrBackups(Level.INFO)) {
      timeoutInMillis=sleepWithBusyWait(timeoutInMillis,sleep);
    }
    if (timeoutInMillis <= 0) {
      return false;
    }
    if (node.isMaster()) {
      syncPartitionRuntimeState();
    }
 else {
      timeoutInMillis=waitForOngoingMigrations(timeoutInMillis,sleep);
      if (timeoutInMillis <= 0) {
        return false;
      }
    }
    long start=Clock.currentTimeMillis();
    boolean ok=checkReplicaSyncState();
    timeoutInMillis-=(Clock.currentTimeMillis() - start);
    if (ok) {
      logger.finest("String_Node_Str");
      return true;
    }
 else {
      if (timeoutInMillis <= 0) {
        return false;
      }
      logger.info("String_Node_Str" + timeoutInMillis + "String_Node_Str");
      timeoutInMillis=sleepWithBusyWait(timeoutInMillis,sleep);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean prepareToSafeShutdown(long timeout,TimeUnit unit){
  long timeoutInMillis=unit.toMillis(timeout);
  int sleep=DEFAULT_PAUSE_MILLIS;
  while (timeoutInMillis > 0) {
    while (timeoutInMillis > 0 && shouldWaitMigrationOrBackups(Level.INFO)) {
      timeoutInMillis=sleepWithBusyWait(timeoutInMillis,sleep);
    }
    if (timeoutInMillis <= 0) {
      break;
    }
    if (node.isMaster()) {
      syncPartitionRuntimeState();
    }
 else {
      timeoutInMillis=waitForOngoingMigrations(timeoutInMillis,sleep);
      if (timeoutInMillis <= 0) {
        break;
      }
    }
    long start=Clock.currentTimeMillis();
    boolean ok=checkReplicaSyncState();
    timeoutInMillis-=(Clock.currentTimeMillis() - start);
    if (ok) {
      logger.finest("String_Node_Str");
      return true;
    }
 else {
      if (timeoutInMillis <= 0) {
        break;
      }
      logger.info("String_Node_Str" + timeoutInMillis + "String_Node_Str");
      timeoutInMillis=sleepWithBusyWait(timeoutInMillis,sleep);
    }
  }
  return false;
}
Program: 48099
Project: 48099
Buggy source:
public int backup() throws Exception {
  int requestedSyncBackupCount=backupAwareOp.getSyncBackupCount() > 0 ? min(InternalPartition.MAX_BACKUP_COUNT,backupAwareOp.getSyncBackupCount()) : 0;
  int requestedAsyncBackupCount=backupAwareOp.getAsyncBackupCount() > 0 ? min(InternalPartition.MAX_BACKUP_COUNT - requestedSyncBackupCount,backupAwareOp.getAsyncBackupCount()) : 0;
  int totalRequestedBackupCount=requestedSyncBackupCount + requestedAsyncBackupCount;
  if (totalRequestedBackupCount == 0) {
    return 0;
  }
  long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(partitionId,totalRequestedBackupCount);
  int maxPossibleBackupCount=min(partitionService.getMemberGroupsSize() - 1,InternalPartition.MAX_BACKUP_COUNT);
  int syncBackupCount=min(maxPossibleBackupCount,requestedSyncBackupCount);
  int asyncBackupCount=min(maxPossibleBackupCount - syncBackupCount,requestedAsyncBackupCount);
  if (!op.returnsResponse()) {
    asyncBackupCount+=syncBackupCount;
    syncBackupCount=0;
  }
  int totalBackupCount=syncBackupCount + asyncBackupCount;
  if (totalBackupCount == 0) {
    return 0;
  }
  return makeBackups(replicaVersions,syncBackupCount,totalBackupCount);
}

Fixed version (ground truth):
public int backup(BackupAwareOperation backupAwareOp) throws Exception {
  int requestedSyncBackupCount=backupAwareOp.getSyncBackupCount() > 0 ? min(InternalPartition.MAX_BACKUP_COUNT,backupAwareOp.getSyncBackupCount()) : 0;
  int requestedAsyncBackupCount=backupAwareOp.getAsyncBackupCount() > 0 ? min(InternalPartition.MAX_BACKUP_COUNT - requestedSyncBackupCount,backupAwareOp.getAsyncBackupCount()) : 0;
  int totalRequestedBackupCount=requestedSyncBackupCount + requestedAsyncBackupCount;
  if (totalRequestedBackupCount == 0) {
    return 0;
  }
  Operation op=(Operation)backupAwareOp;
  InternalPartitionService partitionService=node.getPartitionService();
  long[] replicaVersions=partitionService.incrementPartitionReplicaVersions(op.getPartitionId(),totalRequestedBackupCount);
  int maxPossibleBackupCount=min(partitionService.getMemberGroupsSize() - 1,InternalPartition.MAX_BACKUP_COUNT);
  int syncBackupCount=min(maxPossibleBackupCount,requestedSyncBackupCount);
  int asyncBackupCount=min(maxPossibleBackupCount - syncBackupCount,requestedAsyncBackupCount);
  int totalBackupCount=syncBackupCount + asyncBackupCount;
  if (totalBackupCount == 0) {
    return 0;
  }
  if (!op.returnsResponse()) {
    syncBackupCount=0;
  }
  return makeBackups(backupAwareOp,op.getPartitionId(),replicaVersions,syncBackupCount,totalBackupCount);
}
Program: 48100
Project: 48100
Buggy source:
private Operation initBackupOperation(int replicaIndex){
  Operation backupOp=backupAwareOp.getBackupOperation();
  if (backupOp == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  backupOp.setPartitionId(partitionId).setReplicaIndex(replicaIndex).setServiceName(serviceName);
  return backupOp;
}

Fixed version (ground truth):
private Operation initBackupOperation(BackupAwareOperation backupAwareOp,int replicaIndex){
  Operation backupOp=backupAwareOp.getBackupOperation();
  if (backupOp == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Operation op=(Operation)backupAwareOp;
  backupOp.setPartitionId(op.getPartitionId()).setReplicaIndex(replicaIndex).setServiceName(op.getServiceName());
  return backupOp;
}