nus-yam/ex-repair huggingface dataset:
Program: 40855
Project: 40855
Buggy source:
public void addFlight(Flight flight){
  Date begin=new Date((long)(flight.first * 1000));
  Date end=new Date((long)(flight.last * 1000));
  Folder which;
  if (flight.coords.size() > 0)   which=flight.contains_unreasonable ? unreasonable : reasonable;
 else   which=empty;
  String description="String_Node_Str" + flight.icao24 + "String_Node_Str"+ "String_Node_Str"+ new String(flight.callsign)+ "String_Node_Str"+ "String_Node_Str"+ begin.toString()+ "String_Node_Str"+ "String_Node_Str"+ end.toString()+ "String_Node_Str"+ "String_Node_Str"+ StringUtils.join(flight.serials,"String_Node_Str");
  Placemark placemark=which.createAndAddPlacemark().withName(flight.icao24).withTimePrimitive(new TimeSpan().withBegin(date_formatter.format(begin)).withEnd(date_formatter.format(end))).withDescription(description).withStyleUrl(flight.contains_unreasonable ? "String_Node_Str" : "String_Node_Str");
  placemark.createAndSetLineString().withCoordinates(flight.coords).withAltitudeMode(AltitudeMode.fromValue(AltitudeMode.ABSOLUTE.value())).withId(flight.icao24).withExtrude(false);
  num_flights++;
}

Fixed version (ground truth):
public void addFlight(Flight flight){
  Date begin=new Date((long)(flight.first * 1000));
  Date end=new Date((long)(flight.last * 1000));
  Folder which;
  if (flight.coords.size() > 0)   which=flight.contains_unreasonable ? unreasonable : reasonable;
 else   which=empty;
  String description="String_Node_Str" + flight.icao24 + "String_Node_Str"+ "String_Node_Str"+ new String(flight.callsign)+ "String_Node_Str"+ "String_Node_Str"+ begin.toString()+ "String_Node_Str"+ "String_Node_Str"+ end.toString()+ "String_Node_Str"+ "String_Node_Str"+ StringUtils.join(flight.serials,"String_Node_Str");
  Placemark placemark=which.createAndAddPlacemark().withName(flight.icao24).withTimePrimitive(new TimeSpan().withBegin(date_formatter.format(begin)).withEnd(date_formatter.format(end))).withDescription(description).withStyleUrl(flight.contains_unreasonable ? "String_Node_Str" : "String_Node_Str");
  placemark.createAndSetLineString().withCoordinates(flight.coords).withAltitudeMode(AltitudeMode.fromValue(AltitudeMode.RELATIVE_TO_GROUND.value())).withId(flight.icao24).withExtrude(false);
  num_flights++;
}
Program: 40858
Project: 40858
Buggy source:
/** 
 * @return the decription of the emitter's category according tothe ADS-B message format specification
 */
public String getCategoryDescription(){
  String[][] categories={{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}};
  return categories[4 - getFormatTypeCode()][emitter_category];
}

Fixed version (ground truth):
/** 
 * @return the decription of the emitter's category according tothe ADS-B message format specification
 */
public String getCategoryDescription(){
  String[][] categories={{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}};
  return categories[4 - getFormatTypeCode()][emitter_category];
}
Program: 40861
Project: 40861
Buggy source:
/** 
 * @param in Raw data
 * @param img The GifImage object that is currently read
 * @return Index of the first byte after this block
 * @throws ParseException If the GIF header/trailer is missing, incomplete or unknown
 */
static final int readHeader(final byte[] in,final GifImage img) throws ParseException {
  if (in.length < 6) {
    throw new ParseException("String_Node_Str",0);
  }
  img.header=new String(in,0,6);
  if (!img.header.equals("String_Node_Str") && !img.header.equals("String_Node_Str")) {
    throw new ParseException("String_Node_Str",0);
  }
  return 6;
}

Fixed version (ground truth):
/** 
 * @param in Raw data
 * @param img The GifImage object that is currently read
 * @return Index of the first byte after this block
 * @throws IOException If the GIF header/trailer is missing, incomplete or unknown
 */
static final int readHeader(final byte[] in,final GifImage img) throws IOException {
  if (in.length < 6) {
    throw new IOException("String_Node_Str");
  }
  img.header=new String(in,0,6);
  if (!img.header.equals("String_Node_Str") && !img.header.equals("String_Node_Str")) {
    throw new IOException("String_Node_Str");
  }
  return 6;
}
Program: 40862
Project: 40862
Buggy source:
private final void drawFrame(final GifFrame fr){
  int bgCol=0;
  final int[] activeColTbl;
  if (fr.hasLocColTbl) {
    activeColTbl=fr.localColTbl;
  }
 else {
    activeColTbl=globalColTbl;
    if (!fr.transpColFlag) {
      bgCol=globalColTbl[bgColIndex];
    }
  }
  if (prevDisposal <= 1) {
    setPixels(getPixels(img),prevImg);
  }
 else   if (prevDisposal == 2) {
    prevImg=img;
    img=new BufferedImage(width,height,img.getType());
    final int[] px=getPixels(img);
    Arrays.fill(px,bgCol);
  }
 else   if (prevDisposal == 3) {
    setPixels(getPixels(prevImg),img);
  }
  int[] pixels=decode(fr,activeColTbl);
  if (fr.interlaceFlag) {
    pixels=deinterlace(pixels,fr);
  }
  final int w=fr.width, h=fr.height;
  final BufferedImage layer=new BufferedImage(w,h,img.getType());
  setPixels(pixels,layer);
  final Graphics2D g=img.createGraphics();
  g.drawImage(layer,fr.left,fr.top,null);
  g.dispose();
}

Fixed version (ground truth):
private final void drawFrame(final GifFrame fr){
  int bgCol=0;
  final int[] activeColTbl;
  if (fr.hasLocColTbl) {
    activeColTbl=fr.localColTbl;
  }
 else {
    activeColTbl=globalColTbl;
    if (!fr.transpColFlag) {
      bgCol=globalColTbl[bgColIndex];
    }
  }
switch (prevDisposal) {
case 0:
    setPixels(getPixels(img),prevImg);
  break;
case 1:
setPixels(getPixels(img),prevImg);
break;
case 2:
final BufferedImage bgImage=prevImg;
final int[] px=getPixels(bgImage);
Arrays.fill(px,bgCol);
prevImg=img;
img=bgImage;
break;
case 3:
setPixels(getPixels(prevImg),img);
break;
default :
setPixels(getPixels(img),prevImg);
break;
}
int[] pixels=decode(fr,activeColTbl);
if (fr.interlaceFlag) {
pixels=deinterlace(pixels,fr);
}
final int w=fr.width, h=fr.height;
final BufferedImage layer=new BufferedImage(w,h,img.getType());
setPixels(pixels,layer);
final Graphics2D g=img.createGraphics();
g.drawImage(layer,fr.left,fr.top,null);
g.dispose();
}
Program: 40863
Project: 40863
Buggy source:
CodeTable(final GifFrame fr,final int[] activeColTbl){
  final int numColors=activeColTbl.length;
  initCodeSize=fr.firstCodeSize;
  initCodeLimit=MASK[initCodeSize];
  initTableSize=fr.endOfInfoCode + 1;
  nextCode=initTableSize;
  tbl=new int[4096][];
  for (int c=0; c < numColors; c++) {
    tbl[c]=new int[]{activeColTbl[c]};
  }
  tbl[fr.clearCode]=new int[]{fr.clearCode};
  tbl[fr.endOfInfoCode]=new int[]{fr.endOfInfoCode};
  if (fr.transpColFlag && fr.transpColIndex < numColors) {
    tbl[fr.transpColIndex][0]=0;
  }
}

Fixed version (ground truth):
public CodeTable(){
  tbl=new int[4096][];
  for (int i=0; i < 256; i++) {
    tbl[i]=new int[1];
  }
}
Program: 40864
Project: 40864
Buggy source:
private final void init(final byte[] in){
  this.in=in;
  bitPos=0;
}

Fixed version (ground truth):
private final void init(final GifFrame fr,final int[] activeColTbl){
  final int numColors=activeColTbl.length;
  initCodeSize=fr.firstCodeSize;
  initCodeLimit=MASK[initCodeSize];
  initTableSize=fr.endOfInfoCode + 1;
  nextCode=initTableSize;
  for (int c=0; c < numColors; c++) {
    tbl[c][0]=activeColTbl[c];
  }
  tbl[fr.clearCode]=new int[]{fr.clearCode};
  tbl[fr.endOfInfoCode]=new int[]{fr.endOfInfoCode};
  if (fr.transpColFlag && fr.transpColIndex < numColors) {
    tbl[fr.transpColIndex][0]=0;
  }
}
Program: 40865
Project: 40865
Buggy source:
/** 
 * @param is Image data as input stream. This method will read from the input stream's current position. It will not reset the position before reading and won't reset or close the stream afterwards. Call these methods before and after calling this method as needed.
 * @return A GifImage object exposing the properties of the GIF image.
 * @throws ParseException If the image violates the GIF specification or is truncated.
 * @throws IOException
 */
public static final GifImage read(final InputStream is) throws ParseException, IOException {
  final int numBytes=is.available();
  final byte[] data=new byte[numBytes];
  is.read(data,0,numBytes);
  return read(data);
}

Fixed version (ground truth):
/** 
 * @param is Image data as input stream. This method will read from the input stream's current position. It will not reset the position before reading and won't reset or close the stream afterwards. Call these methods before and after calling this method as needed.
 * @return A GifImage object exposing the properties of the GIF image.
 * @throws IOException If an I/O error occurs, the image violates the GIF specification or the GIF is truncated.
 */
public static final GifImage read(final InputStream is) throws IOException {
  final int numBytes=is.available();
  final byte[] data=new byte[numBytes];
  is.read(data,0,numBytes);
  return read(data);
}
Program: 40866
Project: 40866
Buggy source:
/** 
 * @param fr The GIF frame to whom this image descriptor belongs
 * @param in Raw data
 * @param i Index of the first byte of this block, i.e. the minCodeSize
 * @return
 */
static final int readImgData(final GifFrame fr,final byte[] in,int i){
  final int fileSize=in.length;
  fr.minCodeSize=in[i++] & 0xFF;
  fr.firstCodeSize=fr.minCodeSize + 1;
  fr.clearCode=1 << fr.minCodeSize;
  fr.endOfInfoCode=fr.clearCode + 1;
  final int imgDataSize=readImgDataSize(in,i);
  final byte[] imgData=new byte[imgDataSize + 2];
  int imgDataPos=0;
  int subBlockSize=in[i] & 0xFF;
  while (subBlockSize > 0) {
    try {
      final int nextSubBlockSize=in[i + subBlockSize + 1] & 0xFF;
      System.arraycopy(in,i + 1,imgData,imgDataPos,subBlockSize);
      imgDataPos+=subBlockSize;
      i+=subBlockSize + 1;
      subBlockSize=nextSubBlockSize;
    }
 catch (    final Exception e) {
      subBlockSize=fileSize - i - 1;
      System.arraycopy(in,i + 1,imgData,imgDataPos,subBlockSize);
      imgDataPos+=subBlockSize;
      i+=subBlockSize + 1;
      break;
    }
  }
  fr.data=imgData;
  i++;
  return i;
}

Fixed version (ground truth):
/** 
 * @param fr The GIF frame to whom this image descriptor belongs
 * @param in Raw data
 * @param i Index of the first byte of this block, i.e. the minCodeSize
 * @return
 */
static final int readImgData(final GifFrame fr,final byte[] in,int i){
  final int fileSize=in.length;
  final int minCodeSize=in[i++] & 0xFF;
  final int clearCode=1 << minCodeSize;
  fr.firstCodeSize=minCodeSize + 1;
  fr.clearCode=clearCode;
  fr.endOfInfoCode=clearCode + 1;
  final int imgDataSize=readImgDataSize(in,i);
  final byte[] imgData=new byte[imgDataSize + 2];
  int imgDataPos=0;
  int subBlockSize=in[i] & 0xFF;
  while (subBlockSize > 0) {
    try {
      final int nextSubBlockSizePos=i + subBlockSize + 1;
      final int nextSubBlockSize=in[nextSubBlockSizePos] & 0xFF;
      System.arraycopy(in,i + 1,imgData,imgDataPos,subBlockSize);
      imgDataPos+=subBlockSize;
      i=nextSubBlockSizePos;
      subBlockSize=nextSubBlockSize;
    }
 catch (    final Exception e) {
      subBlockSize=fileSize - i - 1;
      System.arraycopy(in,i + 1,imgData,imgDataPos,subBlockSize);
      imgDataPos+=subBlockSize;
      i+=subBlockSize + 1;
      break;
    }
  }
  fr.data=imgData;
  i++;
  return i;
}
Program: 40867
Project: 40867
Buggy source:
static final int readImgDataSize(final byte[] in,int i){
  final int fileSize=in.length;
  int imgDataPos=0;
  int subBlockSize=in[i] & 0xFF;
  while (subBlockSize > 0) {
    try {
      final int nextSubBlockSize=in[i + subBlockSize + 1] & 0xFF;
      imgDataPos+=subBlockSize;
      i+=subBlockSize + 1;
      subBlockSize=nextSubBlockSize;
    }
 catch (    final Exception e) {
      subBlockSize=fileSize - i - 1;
      imgDataPos+=subBlockSize;
      i+=subBlockSize + 1;
      break;
    }
  }
  return imgDataPos;
}

Fixed version (ground truth):
static final int readImgDataSize(final byte[] in,int i){
  final int fileSize=in.length;
  int imgDataPos=0;
  int subBlockSize=in[i] & 0xFF;
  while (subBlockSize > 0) {
    try {
      final int nextSubBlockSizePos=i + subBlockSize + 1;
      final int nextSubBlockSize=in[nextSubBlockSizePos] & 0xFF;
      imgDataPos+=subBlockSize;
      i=nextSubBlockSizePos;
      subBlockSize=nextSubBlockSize;
    }
 catch (    final Exception e) {
      subBlockSize=fileSize - i - 1;
      imgDataPos+=subBlockSize;
      break;
    }
  }
  return imgDataPos;
}
Program: 40868
Project: 40868
Buggy source:
@Override protected void doStop(){
  fiber.execute(() -> {
    final AtomicInteger countDown=new AtomicInteger(1);
    GenericFutureListener<? extends Future<? super Void>> listener=future -> {
      if (countDown.decrementAndGet() == 0) {
        notifyStopped();
      }
    }
;
    if (listenChannel != null) {
      countDown.incrementAndGet();
      listenChannel.close().addListener(listener);
    }
    allChannels.close().addListener(listener);
    replicatorInstances.values().forEach(ReplicatorInstance::dispose);
    replicatorInstances.clear();
    fiber.dispose();
    fiber=null;
  }
);
}

Fixed version (ground truth):
@Override protected void doStop(){
  fiber.execute(() -> {
    final AtomicInteger countDown=new AtomicInteger(1);
    GenericFutureListener<? extends Future<? super Void>> listener=future -> {
      if (countDown.decrementAndGet() == 0) {
        fiber.dispose();
        fiber=null;
        notifyStopped();
      }
    }
;
    if (listenChannel != null) {
      countDown.incrementAndGet();
      listenChannel.close().addListener(listener);
    }
    allChannels.close().addListener(listener);
    replicatorInstances.values().forEach(ReplicatorInstance::dispose);
    replicatorInstances.clear();
  }
);
}
Program: 40869
Project: 40869
Buggy source:
public QuorumConfiguration getTransitionalConfiguration(Collection<Long> newPeerCollection){
}

Fixed version (ground truth):
public QuorumConfiguration getTransitionalConfiguration(Collection<Long> newPeerCollection){
  if (isTransitional) {
    return new QuorumConfiguration(prevPeers,newPeerCollection);
  }
 else {
    return new QuorumConfiguration(allPeers,newPeerCollection);
  }
}
Program: 40870
Project: 40870
Buggy source:
@Test public void aQuorumChangeCanCompleteEvenIfARemovedPeerTimesOutDuringIt() throws Exception {
  final Set<Long> newPeerIds=smallerPeerSetWithNoneInCommonWithInitialSet();
  final QuorumConfiguration transitionalConfig=QuorumConfiguration.of(initialPeerSet()).getTransitionalConfiguration(newPeerIds);
  final QuorumConfiguration finalConfig=transitionalConfig.getCompletedConfiguration();
  havingElectedALeaderAtOrAfter(term(1));
  final long firstLeaderTerm=currentTerm();
  final long leaderId=currentLeader();
  dropAllAppendsWithThisConfigurationUntilAPreElectionPollTakesPlace(finalConfig);
  leader().changeQuorum(newPeerIds);
  sim.createAndStartReplicators(newPeerIds);
  allPeersExceptLeader((peer) -> assertThat(leader(),willSend(anAppendRequest().containingQuorumConfig(transitionalConfig).to(peer.id))));
  peers(newPeerIds).forEach((peer) -> assertThat(peer,willCommitConfiguration(transitionalConfig)));
  peersBeingRemoved(transitionalConfig).forEach(PeerController::allowToTimeout);
  waitForAnElectionTimeout();
  peersBeingRemoved(transitionalConfig).forEach((peer) -> {
    if (peer.id != leaderId) {
      assertThat(peer,willSend(aPreElectionPoll()));
    }
  }
);
  waitForALeaderWithId(isIn(newPeerIds));
  peers(newPeerIds).forEach((peer) -> assertThat(peer,willCommitConfiguration(finalConfig)));
  peersBeingRemoved(transitionalConfig).forEach((peer) -> assertThat(peer,not(wonAnElectionWithTerm(greaterThan(firstLeaderTerm)))));
}

Fixed version (ground truth):
@Test public void aQuorumChangeCanCompleteEvenIfARemovedPeerTimesOutDuringIt() throws Exception {
  final Set<Long> newPeerIds=smallerPeerSetWithNoneInCommonWithInitialSet();
  final QuorumConfiguration transitionalConfig=QuorumConfiguration.of(initialPeerSet()).getTransitionalConfiguration(newPeerIds);
  final QuorumConfiguration finalConfig=transitionalConfig.getCompletedConfiguration();
  havingElectedALeaderAtOrAfter(term(1));
  final long firstLeaderTerm=currentTerm();
  final long leaderId=currentLeader();
  dropAllAppendsWithThisConfigurationUntilAPreElectionPollTakesPlace(finalConfig);
  leader().changeQuorum(newPeerIds);
  sim.createAndStartReplicators(newPeerIds);
  allPeersExceptLeader((peer) -> assertThat(leader(),willSend(anAppendRequest().containingQuorumConfig(transitionalConfig).to(peer.id))));
  peers(newPeerIds).forEach((peer) -> assertThat(peer,willCommitConfiguration(transitionalConfig)));
  peersBeingRemoved(transitionalConfig).forEach(PeerController::allowToTimeout);
  waitForAnElectionTimeout();
  peersBeingRemoved(transitionalConfig).forEach((peer) -> {
    if (peer.id != leaderId) {
      assertThat(peer,willSend(aPreElectionPoll()));
    }
  }
);
  waitForALeaderWithId(isIn(newPeerIds));
  leader().log(someData());
  peers(newPeerIds).forEach((peer) -> assertThat(peer,willCommitConfiguration(finalConfig)));
  peersBeingRemoved(transitionalConfig).forEach((peer) -> assertThat(peer,not(wonAnElectionWithTerm(greaterThan(firstLeaderTerm)))));
}
Program: 40871
Project: 40871
Buggy source:
@Test public void aSecondQuorumChangeWillOverrideTheFirst() throws Exception {
  final Set<Long> firstPeerSet=smallerPeerSetWithOneInCommonWithInitialSet();
  final Set<Long> secondPeerSet=largerPeerSetWithSomeInCommonWithInitialSet();
  havingElectedALeaderAtOrAfter(term(1));
  leader().changeQuorum(firstPeerSet);
  sim.createAndStartReplicators(firstPeerSet);
  leader().changeQuorum(secondPeerSet);
  sim.createAndStartReplicators(secondPeerSet);
  peers(secondPeerSet).forEach((peer) -> assertThat(peer,willCommitConfiguration(QuorumConfiguration.of(secondPeerSet))));
  waitForALeaderWithId(isIn(secondPeerSet));
}

Fixed version (ground truth):
@Test public void aSecondQuorumChangeWillOverrideTheFirst() throws Exception {
  final Set<Long> firstPeerSet=smallerPeerSetWithOneInCommonWithInitialSet();
  final Set<Long> secondPeerSet=largerPeerSetWithSomeInCommonWithInitialSet();
  havingElectedALeaderAtOrAfter(term(1));
  leader().changeQuorum(firstPeerSet);
  sim.createAndStartReplicators(firstPeerSet);
  leader().changeQuorum(secondPeerSet);
  sim.createAndStartReplicators(secondPeerSet);
  waitForALeaderWithId(isIn(secondPeerSet));
  leader().log(someData());
  peers(secondPeerSet).forEach((peer) -> assertThat(peer,willCommitConfiguration(QuorumConfiguration.of(secondPeerSet))));
}
Program: 40872
Project: 40872
Buggy source:
public boolean hasAny(Matcher<? super T> matcher){
  for (  T element : messageLog) {
    if (matcher.matches(element)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasAny(Matcher<? super T> matcher){
synchronized (messageLog) {
    for (    T element : messageLog) {
      if (matcher.matches(element)) {
        return true;
      }
    }
  }
  return false;
}
Program: 40873
Project: 40873
Buggy source:
private ListenableFuture<T> future(Matcher<? super T> matcher){
  SettableFuture<T> finished=SettableFuture.create();
  fiber.execute(() -> {
    for (    T element : messageLog) {
      if (matcher.matches(element)) {
        finished.set(element);
        return;
      }
    }
    waitingToMatch.put(matcher,finished);
  }
);
  return finished;
}

Fixed version (ground truth):
private ListenableFuture<T> future(Matcher<? super T> matcher){
  SettableFuture<T> finished=SettableFuture.create();
  fiber.execute(() -> {
synchronized (messageLog) {
      for (      T element : messageLog) {
        if (matcher.matches(element)) {
          finished.set(element);
          return;
        }
      }
    }
    waitingToMatch.put(matcher,finished);
  }
);
  return finished;
}
Program: 40874
Project: 40874
Buggy source:
private void calculateLastVisible(long majority,long lastIndexSent){
  if (lastIndexSent == lastCommittedIndex) {
    return;
  }
  HashMap<Long,Integer> bucket=new HashMap<>();
  for (  long lastAcked : peersLastAckedIndex.values()) {
    Integer p=bucket.get(lastAcked);
    if (p == null) {
      bucket.put(lastAcked,1);
    }
 else {
      bucket.put(lastAcked,p + 1);
    }
  }
  long mostAcked=0;
  for (  Map.Entry<Long,Integer> e : bucket.entrySet()) {
    if (e.getValue() >= majority) {
      if (mostAcked != 0) {
        LOG.warn("String_Node_Str",myId,mostAcked,e.getKey());
      }
      mostAcked=e.getKey();
    }
  }
  if (mostAcked == 0) {
    return;
  }
  if (myFirstIndexAsLeader == 0) {
    return;
  }
  if (mostAcked < myFirstIndexAsLeader) {
    LOG.warn("String_Node_Str",myId,mostAcked,myFirstIndexAsLeader);
    return;
  }
  if (mostAcked < lastCommittedIndex) {
    LOG.warn("String_Node_Str",myId,mostAcked,lastCommittedIndex);
    return;
  }
  if (mostAcked == lastCommittedIndex) {
    return;
  }
  setLastCommittedIndex(mostAcked);
  LOG.trace("String_Node_Str",myId,lastCommittedIndex);
}

Fixed version (ground truth):
@FiberOnly private void calculateLastVisible(int majority,long lastIndexSent){
  if (lastIndexSent == lastCommittedIndex) {
    return;
  }
  if (myFirstIndexAsLeader == 0) {
    return;
  }
  SortedMultiset<Long> committedIndexs=TreeMultiset.create(peersLastAckedIndex.values());
  committedIndexs.add(0L,peers.size() - peersLastAckedIndex.size());
  final long greatestIndexCommittedByMajority=Iterables.get(committedIndexs.descendingMultiset(),majority - 1);
  if (greatestIndexCommittedByMajority < myFirstIndexAsLeader) {
    LOG.warn("String_Node_Str",myId,greatestIndexCommittedByMajority,myFirstIndexAsLeader);
    return;
  }
  if (greatestIndexCommittedByMajority < lastCommittedIndex) {
    LOG.warn("String_Node_Str",myId,greatestIndexCommittedByMajority,lastCommittedIndex);
    return;
  }
  if (greatestIndexCommittedByMajority == lastCommittedIndex) {
    return;
  }
  setLastCommittedIndex(greatestIndexCommittedByMajority);
  LOG.trace("String_Node_Str",myId,lastCommittedIndex);
}
Program: 40875
Project: 40875
Buggy source:
@FiberOnly private void sendAppendEntries(long peer,long peerNextIdx,long lastIndexSent,long majority,final List<LogEntry> entries){
}

Fixed version (ground truth):
@FiberOnly private void sendAppendEntries(long peer,long peerNextIdx,long lastIndexSent,int majority,final List<LogEntry> entries){
}
Program: 40876
Project: 40876
Buggy source:
@Override public long currentTimeMillis(){
  return stopWatch.getTime() + offset;
}

Fixed version (ground truth):
@Override public synchronized long currentTimeMillis(){
  if (suspended) {
    return lastTimeMillis + offset;
  }
 else {
    return stopWatch.getTime() + offset;
  }
}
Program: 40877
Project: 40877
Buggy source:
@Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries){
  List<Log.OLogEntry> oLogEntries=new ArrayList<>();
  for (  LogEntry entry : entries) {
    long idx=getNextIdxGreaterThan(0);
    oLogEntries.add(Log.OLogEntry.newBuilder().setTombStone(false).setTerm(entry.getTerm()).setIndex(idx).setQuorumId(quorumId).setValue(ByteString.copyFrom(entry.getData())).build());
  }
  return this.log.logEntry(oLogEntries,quorumId);
}

Fixed version (ground truth):
@Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries){
  List<Log.OLogEntry> oLogEntries=new ArrayList<>();
  for (  LogEntry entry : entries) {
    long idx=getNextIdxGreaterThan(0);
    oLogEntries.add(Log.OLogEntry.newBuilder().setTombStone(false).setTerm(entry.getTerm()).setIndex(idx).setQuorumId(quorumId).setValue(ByteString.copyFrom(entry.getData())).build());
  }
  if (oLogEntries.size() > 0) {
    currentTerm=oLogEntries.get(oLogEntries.size() - 1).getTerm();
  }
  return this.log.logEntry(oLogEntries,quorumId);
}
Program: 40878
Project: 40878
Buggy source:
private void becomeLeader(){
  LOG.warn("String_Node_Str",myId,currentTerm);
  myState=State.LEADER;
  long myNextLog=log.getLastIndex() + 1;
  peersLastAckedIndex=new HashMap<>(peers.size());
  peersNextIndex=new HashMap<>(peers.size() - 1);
  for (  long peer : peers) {
    if (peer == myId)     continue;
    peersNextIndex.put(peer,myNextLog);
  }
  myFirstIndexAsLeader=0;
  lastCommittedIndex=0;
  stateChangeChannel.publish(new ReplicatorInstanceEvent(ReplicatorInstanceEvent.EventType.LEADER_ELECTED,this,myId,info.currentTimeMillis(),null));
  startQueueConsumer();
}

Fixed version (ground truth):
private void becomeLeader(){
  LOG.warn("String_Node_Str",myId,currentTerm);
  myState=State.LEADER;
  long myNextLog=log.getLastIndex() + 1;
  peersLastAckedIndex=new HashMap<>(peers.size());
  peersNextIndex=new HashMap<>(peers.size() - 1);
  for (  long peer : peers) {
    if (peer == myId)     continue;
    peersNextIndex.put(peer,myNextLog);
  }
  myFirstIndexAsLeader=0;
  stateChangeChannel.publish(new ReplicatorInstanceEvent(ReplicatorInstanceEvent.EventType.LEADER_ELECTED,this,myId,info.currentTimeMillis(),null));
  startQueueConsumer();
}
Program: 40879
Project: 40879
Buggy source:
private void calculateLastVisible(long majority,long lastIndexSent){
  if (lastIndexSent == lastCommittedIndex)   return;
  HashMap<Long,Integer> bucket=new HashMap<>();
  for (  long lastAcked : peersLastAckedIndex.values()) {
    Integer p=bucket.get(lastAcked);
    if (p == null)     bucket.put(lastAcked,1);
 else     bucket.put(lastAcked,p + 1);
  }
  long mostAcked=0;
  for (  Map.Entry<Long,Integer> e : bucket.entrySet()) {
    if (e.getValue() >= majority) {
      if (mostAcked != 0) {
        LOG.warn("String_Node_Str",myId,mostAcked,e.getKey());
      }
      mostAcked=e.getKey();
    }
  }
  if (mostAcked == 0)   return;
  if (myFirstIndexAsLeader == 0)   return;
  if (mostAcked < myFirstIndexAsLeader) {
    LOG.warn("String_Node_Str",myId,mostAcked,myFirstIndexAsLeader);
    return;
  }
  if (mostAcked < lastCommittedIndex) {
    LOG.warn("String_Node_Str",myId,mostAcked,lastCommittedIndex);
    return;
  }
  if (mostAcked == lastCommittedIndex) {
    return;
  }
  this.lastCommittedIndex=mostAcked;
  notifyLastCommitted();
  LOG.trace("String_Node_Str",myId,lastCommittedIndex);
}

Fixed version (ground truth):
private void calculateLastVisible(long majority,long lastIndexSent){
  if (lastIndexSent == lastCommittedIndex)   return;
  HashMap<Long,Integer> bucket=new HashMap<>();
  for (  long lastAcked : peersLastAckedIndex.values()) {
    Integer p=bucket.get(lastAcked);
    if (p == null)     bucket.put(lastAcked,1);
 else     bucket.put(lastAcked,p + 1);
  }
  long mostAcked=0;
  for (  Map.Entry<Long,Integer> e : bucket.entrySet()) {
    if (e.getValue() >= majority) {
      if (mostAcked != 0) {
        LOG.warn("String_Node_Str",myId,mostAcked,e.getKey());
      }
      mostAcked=e.getKey();
    }
  }
  if (mostAcked == 0)   return;
  if (myFirstIndexAsLeader == 0)   return;
  if (mostAcked < myFirstIndexAsLeader) {
    LOG.warn("String_Node_Str",myId,mostAcked,myFirstIndexAsLeader);
    return;
  }
  if (mostAcked < lastCommittedIndex) {
    LOG.warn("String_Node_Str",myId,mostAcked,lastCommittedIndex);
    return;
  }
  if (mostAcked == lastCommittedIndex) {
    return;
  }
  setLastCommittedIndex(mostAcked);
  LOG.trace("String_Node_Str",myId,lastCommittedIndex);
}
Program: 40881
Project: 40881
Buggy source:
@Override public void onSuccess(Boolean result){
  AppendEntriesReply m=new AppendEntriesReply(currentTerm,true,0);
  RpcReply reply=new RpcReply(m);
  request.reply(reply);
  lastCommittedIndex=Math.min(appendMessage.getCommitIndex(),log.getLastIndex());
  notifyLastCommitted();
}

Fixed version (ground truth):
@Override public void onSuccess(Boolean result){
  AppendEntriesReply m=new AppendEntriesReply(currentTerm,true,0);
  RpcReply reply=new RpcReply(m);
  request.reply(reply);
  long newCommitIndex=Math.min(appendMessage.getCommitIndex(),log.getLastIndex());
  setLastCommittedIndex(newCommitIndex);
}
Program: 40882
Project: 40882
Buggy source:
private void becomeLeader(){
  LOG.warn("String_Node_Str",myId);
  myState=State.LEADER;
  long myNextLog=log.getLastIndex() + 1;
  peersLastAckedIndex=new HashMap<>(peers.size());
  peersNextIndex=new HashMap<>(peers.size() - 1);
  for (  long peer : peers) {
    if (peer == myId)     continue;
    peersNextIndex.put(peer,myNextLog);
  }
  myFirstIndexAsLeader=0;
  lastCommittedIndex=0;
  startQueueConsumer();
}

Fixed version (ground truth):
private void becomeLeader(){
  LOG.warn("String_Node_Str",myId,currentTerm);
  myState=State.LEADER;
  long myNextLog=log.getLastIndex() + 1;
  peersLastAckedIndex=new HashMap<>(peers.size());
  peersNextIndex=new HashMap<>(peers.size() - 1);
  for (  long peer : peers) {
    if (peer == myId)     continue;
    peersNextIndex.put(peer,myNextLog);
  }
  myFirstIndexAsLeader=0;
  lastCommittedIndex=0;
  startQueueConsumer();
}
Program: 40883
Project: 40883
Buggy source:
@Override public void run(){
  consumeQueue();
}

Fixed version (ground truth):
@Override public void run(){
  try {
    consumeQueue();
  }
 catch (  Throwable t) {
    failReplicatorInstance(t);
  }
}
Program: 40884
Project: 40884
Buggy source:
@FiberOnly private void startQueueConsumer(){
  queueConsumer=fiber.scheduleAtFixedRate(new Runnable(){
    @Override public void run(){
      consumeQueue();
    }
  }
,0,info.groupCommitDelay(),TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
@FiberOnly private void startQueueConsumer(){
  queueConsumer=fiber.scheduleAtFixedRate(new Runnable(){
    @Override public void run(){
      try {
        consumeQueue();
      }
 catch (      Throwable t) {
        failReplicatorInstance(t);
      }
    }
  }
,0,info.groupCommitDelay(),TimeUnit.MILLISECONDS);
}
Program: 40886
Project: 40886
Buggy source:
@Override protected void channelRead0(final ChannelHandlerContext ctx,final RaftWireMessage msg) throws Exception {
  fiber.execute(new Runnable(){
    @Override public void run(){
      handleWireInboundMessage(ctx.channel(),msg);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void channelRead0(final ChannelHandlerContext ctx,final RaftWireMessage msg) throws Exception {
  fiber.execute(() -> {
    handleWireInboundMessage(ctx.channel(),msg);
  }
);
}
Program: 40887
Project: 40887
Buggy source:
/** 
 * Uses idToken to retrieve the user account information from GITkit service.
 * @param idToken
 */
public JSONObject getAccountInfo(String idToken) throws GitkitClientException, GitkitServerException {
  try {
    JSONObject params=new JSONObject().put("String_Node_Str",idToken);
    return invokeGitkitApi("String_Node_Str",params,null);
  }
 catch (  JSONException e) {
    throw new GitkitServerException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Uses idToken to retrieve the user account information from GITkit service.
 * @param idToken
 */
public JSONObject getAccountInfo(String idToken) throws GitkitClientException, GitkitServerException {
  try {
    JSONObject params=new JSONObject().put("String_Node_Str",idToken);
    return invokeGoogle2LegOauthApi("String_Node_Str",params);
  }
 catch (  JSONException e) {
    throw new GitkitServerException("String_Node_Str");
  }
}
Program: 40888
Project: 40888
Buggy source:
/** 
 * <p> Use Hazelcast's   {@code ReflectionHelper} to extract a field in an entry, and use this is in the comparison.</P>
 * @param o1 An entry in a map
 * @param o2 Another entry in the map
 * @return Comparison result
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public int compare(Entry<?,?> o1,Entry<?,?> o2){
  try {
    Object o1Field=ReflectionHelper.extractValue(o1.getValue(),this.attributeName);
    Object o2Field=ReflectionHelper.extractValue(o2.getValue(),this.attributeName);
    if (o1Field == null) {
      return this.direction;
    }
    if (o2Field == null) {
      return -1 * this.direction;
    }
    if (o1Field instanceof Comparable && o2Field instanceof Comparable) {
      return this.direction * ((Comparable)o1Field).compareTo((Comparable)o2Field);
    }
  }
 catch (  Exception ignore) {
    return 0;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * <p> Use Hazelcast's   {@code ReflectionHelper} to extract a field in an entry, and use this is in the comparison.</P>
 * @param o1 An entry in a map
 * @param o2 Another entry in the map
 * @return Comparison result
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public int compare(Entry<?,?> o1,Entry<?,?> o2){
  try {
    Object o1Field=ReflectionHelper.extractValue(o1.getValue(),this.attributeName);
    Object o2Field=ReflectionHelper.extractValue(o2.getValue(),this.attributeName);
    if (o1Field == o2Field) {
      return 0;
    }
    if (o1Field == null) {
      return this.direction;
    }
    if (o2Field == null) {
      return -1 * this.direction;
    }
    if (o1Field instanceof Comparable && o2Field instanceof Comparable) {
      return this.direction * ((Comparable)o1Field).compareTo(o2Field);
    }
  }
 catch (  Exception ignore) {
    return 0;
  }
  return 0;
}
Program: 40889
Project: 40889
Buggy source:
/** 
 * <P> Execute   {@code countBy*()} queries against a Hazelcast map.</P>
 * @param criteria Predicate to use, not null
 * @param keyspace The map name
 * @return Results from Hazelcast
 */
@Override public long count(final Predicate<?,?> criteria,final String keyspace){
  return this.getAdapter().getMap(keyspace).keySet(criteria).size();
}

Fixed version (ground truth):
/** 
 * <P> Execute   {@code countBy*()} queries against a Hazelcast map.</P>
 * @param criteria Predicate to use, not null
 * @param keyspace The map name
 * @return Results from Hazelcast
 */
@Override public long count(final Predicate<?,?> criteria,final String keyspace){
  final HazelcastKeyValueAdapter adapter=getAdapter();
  Assert.notNull(adapter,"String_Node_Str");
  return adapter.getMap(keyspace).keySet(criteria).size();
}
Program: 40890
Project: 40890
Buggy source:
/** 
 * <P> Construct the final query predicate for Hazelcast to execute, from the base query plus any paging and sorting. </P> <P> Variations here allow the base query predicate to be omitted, sorting to be omitted, and paging to be omitted. </P>
 * @param criteria Search criteria, null means match everything
 * @param sort Possibly null collation
 * @param offset Start point of returned page, -1 if not used
 * @param rows Size of page, -1 if not used
 * @param keyspace The map name
 * @return Results from Hazelcast
 */
@Override public Collection<?> execute(final Predicate<?,?> criteria,final Comparator<Entry<?,?>> sort,final long offset,final int rows,final String keyspace){
  Predicate<?,?> predicateToUse=criteria;
  @SuppressWarnings({"String_Node_Str","String_Node_Str"}) Comparator<Entry> sortToUse=((Comparator<Entry>)(Comparator)sort);
  if (rows > 0) {
    PagingPredicate pp=new PagingPredicate(predicateToUse,sortToUse,rows);
    long x=offset / rows;
    while (x > 0) {
      pp.nextPage();
      x--;
    }
    predicateToUse=pp;
  }
 else {
    if (sortToUse != null) {
      predicateToUse=new PagingPredicate(predicateToUse,sortToUse,Integer.MAX_VALUE);
    }
  }
  if (predicateToUse == null) {
    return this.getAdapter().getMap(keyspace).values();
  }
 else {
    return this.getAdapter().getMap(keyspace).values(predicateToUse);
  }
}

Fixed version (ground truth):
/** 
 * <P> Construct the final query predicate for Hazelcast to execute, from the base query plus any paging and sorting. </P> <P> Variations here allow the base query predicate to be omitted, sorting to be omitted, and paging to be omitted. </P>
 * @param criteria Search criteria, null means match everything
 * @param sort Possibly null collation
 * @param offset Start point of returned page, -1 if not used
 * @param rows Size of page, -1 if not used
 * @param keyspace The map name
 * @return Results from Hazelcast
 */
@Override public Collection<?> execute(final Predicate<?,?> criteria,final Comparator<Entry<?,?>> sort,final long offset,final int rows,final String keyspace){
  final HazelcastKeyValueAdapter adapter=getAdapter();
  Assert.notNull(adapter,"String_Node_Str");
  Predicate<?,?> predicateToUse=criteria;
  @SuppressWarnings({"String_Node_Str","String_Node_Str"}) Comparator<Entry> sortToUse=((Comparator<Entry>)(Comparator)sort);
  if (rows > 0) {
    PagingPredicate pp=new PagingPredicate(predicateToUse,sortToUse,rows);
    long x=offset / rows;
    while (x > 0) {
      pp.nextPage();
      x--;
    }
    predicateToUse=pp;
  }
 else {
    if (sortToUse != null) {
      predicateToUse=new PagingPredicate(predicateToUse,sortToUse,Integer.MAX_VALUE);
    }
  }
  if (predicateToUse == null) {
    return adapter.getMap(keyspace).values();
  }
 else {
    return adapter.getMap(keyspace).values(predicateToUse);
  }
}
Program: 40891
Project: 40891
Buggy source:
/** 
 * @param A query in Spring form
 * @return The same in Hazelcast form
 */
public Predicate<?,?> resolve(KeyValueQuery<?> query){
  if (query == null || query.getCriteria() == null) {
    return null;
  }
  if (query.getCriteria() instanceof PagingPredicate) {
    PagingPredicate pagingPredicate=(PagingPredicate)query.getCriteria();
    query.limit(pagingPredicate.getPageSize());
    return pagingPredicate.getPredicate();
  }
  if (query.getCriteria() instanceof Predicate) {
    return (Predicate<?,?>)query.getCriteria();
  }
  throw new UnsupportedOperationException(query.toString());
}

Fixed version (ground truth):
/** 
 * @param A query in Spring form
 * @return The same in Hazelcast form
 */
public Predicate<?,?> resolve(KeyValueQuery<?> query){
  if (query == null) {
    return null;
  }
  final Object criteria=query.getCriteria();
  if (criteria == null) {
    return null;
  }
  if (criteria instanceof PagingPredicate) {
    PagingPredicate pagingPredicate=(PagingPredicate)criteria;
    query.limit(pagingPredicate.getPageSize());
    return pagingPredicate.getPredicate();
  }
  if (criteria instanceof Predicate) {
    return (Predicate<?,?>)criteria;
  }
  throw new UnsupportedOperationException(query.toString());
}
Program: 40892
Project: 40892
Buggy source:
/** 
 * <P> Create the query from the bind parameters. </P>
 * @param parameters Possibly empty list of query parameters
 * @return A ready-to-use query
 */
protected KeyValueQuery<?> prepareQuery(Object[] parameters){
  PartTree tree=null;
  if (this.queryMethod.getParameters().getNumberOfParameters() > 0) {
    tree=new PartTree(getQueryMethod().getName(),getQueryMethod().getEntityInformation().getJavaType());
    this.isCount=tree.isCountProjection();
    this.isDelete=tree.isDelete();
    this.isDistinct=tree.isDistinct();
  }
 else {
    this.isCount=false;
    this.isDelete=false;
    this.isDistinct=false;
  }
  ParametersParameterAccessor accessor=this.prepareAccessor(parameters,tree);
  KeyValueQuery<?> query=createQuery(accessor);
  if (accessor.getPageable() != null) {
    query.setOffset(accessor.getPageable().getOffset());
    query.setRows(accessor.getPageable().getPageSize());
  }
 else {
    query.setOffset(-1);
    query.setRows(-1);
  }
  if (accessor.getSort() != null) {
    query.setSort(accessor.getSort());
  }
  return query;
}

Fixed version (ground truth):
/** 
 * <P> Create the query from the bind parameters. </P>
 * @param parameters Possibly empty list of query parameters
 * @return A ready-to-use query
 */
protected KeyValueQuery<?> prepareQuery(Object[] parameters){
  PartTree tree=null;
  if (this.queryMethod.getParameters().getNumberOfParameters() > 0) {
    tree=new PartTree(getQueryMethod().getName(),getQueryMethod().getEntityInformation().getJavaType());
    this.isCount=tree.isCountProjection();
    this.isDelete=tree.isDelete();
    this.isDistinct=tree.isDistinct();
  }
 else {
    this.isCount=false;
    this.isDelete=false;
    this.isDistinct=false;
  }
  ParametersParameterAccessor accessor=this.prepareAccessor(parameters,tree);
  KeyValueQuery<?> query=createQuery(accessor);
  if (accessor.getPageable() != Pageable.unpaged()) {
    query.setOffset(accessor.getPageable().getOffset());
    query.setRows(accessor.getPageable().getPageSize());
  }
 else {
    query.setOffset(-1);
    query.setRows(-1);
  }
  if (accessor.getSort() != Sort.unsorted()) {
    query.setSort(accessor.getSort());
  }
  return query;
}
Program: 40893
Project: 40893
Buggy source:
/** 
 * <P> Handle   {@code @Param}. </P> <OL> <LI><B>Without   {@code @Param}</B> <P> Arguments to the call are assumed to follow the same sequence as cited in the method name. </P> <P> Eg. <pre> findBy<U>One</U>And<U>Two</U>(String <U>one</U>, String <U>two</U>); </pre> </P> </LI> <LI><B>With   {@code @Param}</B> <P> Arguments to the call are use the   {@code @Param} to match them against the fields.<P> Eg. <pre> findBy<U>One</U>And<U>Two</U>(@Param("two") String <U>two</U>, @Param("one") String <U>one</U>); </pre> </P> </LI> </OL>
 * @param parameters Possibly empty
 * @param partTree Query tree to traverse
 * @return Paremeters in correct order
 */
private ParametersParameterAccessor prepareAccessor(final Object[] originalParameters,final PartTree partTree){
  if (!this.isRearrangeKnown) {
    this.prepareRearrange(partTree,this.queryMethod.getParameters().getBindableParameters());
    this.isRearrangeKnown=true;
  }
  Object[] parameters=originalParameters;
  if (parameters != null && this.isRearrangeRequired) {
    parameters=new Object[originalParameters.length];
    for (int i=0; i < parameters.length; i++) {
      int index=rearrangeIndex[i];
      parameters[i]=originalParameters[index];
    }
  }
  return new ParametersParameterAccessor(this.queryMethod.getParameters(),parameters);
}

Fixed version (ground truth):
/** 
 * <P> Handle   {@code @Param}. </P> <OL> <LI><B>Without   {@code @Param}</B> <P> Arguments to the call are assumed to follow the same sequence as cited in the method name. </P> <P> Eg. <pre> findBy<U>One</U>And<U>Two</U>(String <U>one</U>, String <U>two</U>); </pre> </P> </LI> <LI><B>With   {@code @Param}</B> <P> Arguments to the call are use the   {@code @Param} to match them against the fields.<P> Eg. <pre> findBy<U>One</U>And<U>Two</U>(@Param("two") String <U>two</U>, @Param("one") String <U>one</U>); </pre> </P> </LI> </OL>
 * @param originalParameters Possibly empty
 * @param partTree Query tree to traverse
 * @return Parameters in correct order
 */
private ParametersParameterAccessor prepareAccessor(final Object[] originalParameters,final PartTree partTree){
  if (!this.isRearrangeKnown) {
    this.prepareRearrange(partTree,this.queryMethod.getParameters().getBindableParameters());
    this.isRearrangeKnown=true;
  }
  Object[] parameters=originalParameters;
  Assert.notNull(parameters,"String_Node_Str");
  if (this.isRearrangeRequired) {
    parameters=new Object[originalParameters.length];
    for (int i=0; i < parameters.length; i++) {
      int index=rearrangeIndex[i];
      parameters[i]=originalParameters[index];
    }
  }
  return new ParametersParameterAccessor(this.queryMethod.getParameters(),parameters);
}
Program: 40894
Project: 40894
Buggy source:
/** 
 * Creates a new   {@link HazelcastQueryCreator} for the given {@link PartTree} and {@link ParameterAccessor}. The latter is used to hand actual parameter values into the callback methods as well as to apply dynamic sorting via a  {@link Sort} parameter.
 * @param tree must not be {@literal null}.
 * @param parameters can be {@literal null}.
 */
public HazelcastQueryCreator(PartTree tree,ParameterAccessor parameters){
  super(tree,parameters);
  if (tree.isLimiting() && tree.getMaxResults() > 0) {
    this.limit=tree.getMaxResults();
  }
 else {
    this.limit=0;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link HazelcastQueryCreator} for the given {@link PartTree} and {@link ParameterAccessor}. The latter is used to hand actual parameter values into the callback methods as well as to apply dynamic sorting via a  {@link Sort} parameter.
 * @param tree must not be {@literal null}.
 * @param parameters can be {@literal null}.
 */
public HazelcastQueryCreator(PartTree tree,ParameterAccessor parameters){
  super(tree,parameters);
  final Integer maxResults=tree.getMaxResults();
  if (tree.isLimiting() && maxResults != null && maxResults > 0) {
    this.limit=maxResults;
  }
 else {
    this.limit=0;
  }
}
Program: 40895
Project: 40895
Buggy source:
/** 
 * <P> Sort on a sequence of fields, possibly none. </P>
 * @param query If not null, will contain one of more {@link Sort.Order} objects.
 * @return A sequence of comparators or {@code null}
 */
public Comparator<Entry<?,?>> resolve(KeyValueQuery<?> query){
  if (query == null || query.getSort() == null) {
    return null;
  }
  CompoundComparator<Entry<?,?>> compoundComparator=new CompoundComparator<>();
  for (  Order order : query.getSort()) {
    if (order.getProperty().indexOf('.') > -1) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    if (order.isIgnoreCase()) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    if (NullHandling.NATIVE != order.getNullHandling()) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    HazelcastPropertyComparator hazelcastPropertyComparator=new HazelcastPropertyComparator(order.getProperty(),order.isAscending());
    compoundComparator.addComparator(hazelcastPropertyComparator);
  }
  return compoundComparator;
}

Fixed version (ground truth):
/** 
 * <P> Sort on a sequence of fields, possibly none. </P>
 * @param query If not null, will contain one of more {@link Sort.Order} objects.
 * @return A sequence of comparators or {@code null}
 */
public Comparator<Entry<?,?>> resolve(KeyValueQuery<?> query){
  if (query == null || query.getSort() == Sort.unsorted()) {
    return null;
  }
  CompoundComparator<Entry<?,?>> compoundComparator=new CompoundComparator<>();
  for (  Order order : query.getSort()) {
    if (order.getProperty().indexOf('.') > -1) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    if (order.isIgnoreCase()) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    if (NullHandling.NATIVE != order.getNullHandling()) {
      throw new UnsupportedOperationException("String_Node_Str" + order);
    }
    HazelcastPropertyComparator hazelcastPropertyComparator=new HazelcastPropertyComparator(order.getProperty(),order.isAscending());
    compoundComparator.addComparator(hazelcastPropertyComparator);
  }
  return compoundComparator;
}
Program: 40896
Project: 40896
Buggy source:
@Test public void deleteShouldRemoveObjectCorrectly(){
  operations.insert("String_Node_Str",FOO_ONE);
  operations.delete("String_Node_Str",Foo.class);
  assertThat(operations.findById("String_Node_Str",Foo.class),nullValue());
}

Fixed version (ground truth):
@Test public void deleteShouldRemoveObjectCorrectly(){
  operations.insert("String_Node_Str",FOO_ONE);
  operations.delete("String_Node_Str",Foo.class);
  assertFalse(operations.findById("String_Node_Str",Foo.class).isPresent());
}
Program: 40897
Project: 40897
Buggy source:
@Test public void updateShouldReplaceExistingObject(){
  operations.insert("String_Node_Str",FOO_ONE);
  operations.update("String_Node_Str",FOO_TWO);
  assertThat(operations.findById("String_Node_Str",Foo.class),is(FOO_TWO));
}

Fixed version (ground truth):
@Test public void updateShouldReplaceExistingObject(){
  operations.insert("String_Node_Str",FOO_ONE);
  operations.update("String_Node_Str",FOO_TWO);
  assertThat(operations.findById("String_Node_Str",Foo.class),is(Optional.of(FOO_TWO)));
}