nus-yam/ex-repair huggingface dataset:
Program: 87228
Project: 87228
Buggy source:
/** 
 * Determines whether a sufficient number of accepts can be tallied against the specified begin.
 * @param aBegin
 * @return A Learned packet to be logged if there are sufficient accepts, <code>null</code> otherwise.
 */
private Transport.Packet tallyAccepts(Begin aBegin){
  int myAcceptTally=0;
  List<Accept> myAccepts=_acceptLedgers.get(aBegin.getSeqNum());
  if (myAccepts == null)   return null;
  for (  Accept myAcc : myAccepts)   if (myAcc.getRndNumber() == aBegin.getRndNumber())   ++myAcceptTally;
  if (myAcceptTally >= _common.getTransport().getFD().getMajority()) {
    _logger.trace(toString() + "String_Node_Str");
    return _common.getTransport().getPickler().newPacket(new Learned(aBegin.getSeqNum(),aBegin.getRndNumber()));
  }
 else   return null;
}

Fixed version (ground truth):
/** 
 * Determines whether a sufficient number of accepts can be tallied against the specified begin.
 * @param aBegin
 * @return A Learned packet to be logged if there are sufficient accepts, <code>null</code> otherwise.
 */
private Transport.Packet tallyAccepts(Begin aBegin){
  int myAcceptTally=0;
  Set<Transport.Packet> myAccepts=_acceptLedgers.get(aBegin.getSeqNum());
  if (myAccepts == null)   return null;
  for (  Transport.Packet myAcc : myAccepts)   if (((Accept)myAcc.getMessage()).getRndNumber() == aBegin.getRndNumber())   ++myAcceptTally;
  if (myAcceptTally >= _common.getTransport().getFD().getMajority()) {
    _logger.trace(toString() + "String_Node_Str");
    return _common.getTransport().getPickler().newPacket(new Learned(aBegin.getSeqNum(),aBegin.getRndNumber()));
  }
 else   return null;
}
Program: 87229
Project: 87229
Buggy source:
private void run() throws Exception {
  ClientDispatcher myClient=new ClientDispatcher();
  Transport myTransport=_env._factory.newTransport(null);
  myTransport.routeTo(myClient);
  myClient.init(myTransport);
  long opsSinceCkpt=0;
  if (!_env._calibrate) {
  }
  while (_env._opCount < _env._maxCycles) {
    ByteBuffer myBuffer=ByteBuffer.allocate(8);
    myBuffer.putLong(_env._opCount);
    Proposal myProposal=new Proposal("String_Node_Str",myBuffer.array());
    myClient.send(new Envelope(myProposal),_env._currentLeader.getLocalAddress());
    VoteOutcome myEv=myClient.getNext(10000);
    ++opsSinceCkpt;
    if (myEv.getResult() == VoteOutcome.Reason.OTHER_LEADER) {
      _env.updateLeader(myEv.getLeader());
    }
 else     if (myEv.getResult() == VoteOutcome.Reason.VALUE) {
      if (opsSinceCkpt >= _env._ckptCycle) {
        _env.checkpoint();
        opsSinceCkpt=0;
      }
    }
    _env._opCount++;
  }
  _env.terminate();
  _env._factory.stop();
}

Fixed version (ground truth):
private void run() throws Exception {
  ClientDispatcher myClient=new ClientDispatcher();
  Transport myTransport=_env._factory.newTransport(null);
  myTransport.routeTo(myClient);
  myClient.init(myTransport);
  long opsSinceCkpt=0;
  if (!_env._calibrate) {
  }
  while (_env._opCount < _env._maxCycles) {
    ByteBuffer myBuffer=ByteBuffer.allocate(8);
    myBuffer.putLong(_env._opCount);
    Proposal myProposal=new Proposal("String_Node_Str",myBuffer.array());
    myClient.send(new Envelope(myProposal),_env._currentLeader.getLocalAddress());
    VoteOutcome myEv=myClient.getNext(10000);
    ++opsSinceCkpt;
    if (myEv.getResult() == VoteOutcome.Reason.OTHER_LEADER) {
      _env.updateLeader(myEv.getLeader());
    }
 else     if (myEv.getResult() == VoteOutcome.Reason.VALUE) {
      if (opsSinceCkpt >= _env._ckptCycle) {
        _env.checkpoint();
        opsSinceCkpt=0;
      }
    }
    _env._opCount++;
  }
  myTransport.terminate();
  _env.terminate();
  _env._factory.stop();
}
Program: 87230
Project: 87230
Buggy source:
public static void main(String[] anArgs) throws Exception {
  Args myArgs=CliFactory.parseArguments(Args.class,anArgs);
  long myStart=System.currentTimeMillis();
  new LongTerm(myArgs.getSeed(),myArgs.getCycles(),myArgs.isCalibrate(),myArgs.getCkptCycle()).run();
  double myDuration=(System.currentTimeMillis() - myStart) / 1000.0;
  System.out.println("String_Node_Str" + myArgs.getCycles() + "String_Node_Str"+ myDuration+ "String_Node_Str");
  if (myArgs.isCalibrate()) {
    double myOpsPerSec=myDuration / myArgs.getCycles();
    double myOpsHour=myOpsPerSec * 60 * 60;
    System.out.println("String_Node_Str" + myOpsPerSec + "String_Node_Str"+ myOpsHour);
  }
}

Fixed version (ground truth):
public static void main(String[] anArgs) throws Exception {
  Args myArgs=CliFactory.parseArguments(Args.class,anArgs);
  LongTerm myLT=new LongTerm(myArgs.getSeed(),myArgs.getCycles(),myArgs.isCalibrate(),myArgs.getCkptCycle());
  long myStart=System.currentTimeMillis();
  myLT.run();
  double myDuration=(System.currentTimeMillis() - myStart) / 1000.0;
  System.out.println("String_Node_Str" + myArgs.getCycles() + "String_Node_Str"+ myDuration+ "String_Node_Str");
  if (myArgs.isCalibrate()) {
    double myOpsPerSec=myDuration / myArgs.getCycles();
    double myOpsHour=myOpsPerSec * 60 * 60;
    System.out.println("String_Node_Str" + myOpsPerSec + "String_Node_Str"+ myOpsHour);
  }
}
Program: 87231
Project: 87231
Buggy source:
private void expired(){
  _logger.info(toString() + "String_Node_Str");
synchronized (this) {
    if (_stateMachine.getCurrentState().equals(State.SUCCESS)) {
      ++_tries;
      if (_tries < MAX_TRIES) {
        cancelInteraction();
        process(_messages);
        _messages.clear();
        return;
      }
    }
    error(VoteOutcome.Reason.VOTE_TIMEOUT);
  }
}

Fixed version (ground truth):
private void expired(){
synchronized (this) {
    _logger.info(toString() + "String_Node_Str");
switch (_stateMachine.getCurrentState()) {
case SUCCESS:
{
        ++_tries;
        if (_tries < MAX_TRIES) {
          cancelInteraction();
          process(_messages);
          _messages.clear();
        }
 else {
          error(VoteOutcome.Reason.VOTE_TIMEOUT);
        }
        break;
      }
case EXIT:
case ABORT:
case SHUTDOWN:
{
      break;
    }
default :
{
    error(VoteOutcome.Reason.VOTE_TIMEOUT);
    break;
  }
}
}
}
Program: 87232
Project: 87232
Buggy source:
void resetLeaderAction(){
synchronized (this) {
    _lastLeaderActionTime=0;
  }
}

Fixed version (ground truth):
void resetLeaderAction(){
  _lastLeaderActionTime.set(0);
}
Program: 87233
Project: 87233
Buggy source:
void clearLeadership(){
  _lastCollect.set(new FakePacket(Collect.INITIAL));
  _lastLeaderActionTime=0;
}

Fixed version (ground truth):
void clearLeadership(){
  _lastCollect.set(new FakePacket(Collect.INITIAL));
  resetLeaderAction();
}
Program: 87234
Project: 87234
Buggy source:
/** 
 * @return <code>true</code> if the collect is either from the existingleader, or there is no leader or there's been nothing heard from the current leader within DEFAULT_LEASE milliseconds else <code>false</code>
 */
boolean amAccepting(Transport.Packet aCollect){
  long myCurrentTime=System.currentTimeMillis();
  if (((Collect)_lastCollect.get().getMessage()).isInitial()) {
    _logger.debug("String_Node_Str");
    return true;
  }
 else {
    if (_leaderUtils.sameLeader(aCollect,_lastCollect.get())) {
      _logger.debug("String_Node_Str");
      return true;
    }
 else     _logger.debug("String_Node_Str" + myCurrentTime + "String_Node_Str"+ _lastLeaderActionTime+ "String_Node_Str"+ Constants.getLeaderLeaseDuration()+ "String_Node_Str"+ (myCurrentTime > _lastLeaderActionTime + Constants.getLeaderLeaseDuration()));
    return (myCurrentTime > _lastLeaderActionTime + Constants.getLeaderLeaseDuration());
  }
}

Fixed version (ground truth):
/** 
 * @return <code>true</code> if the collect is either from the existingleader, or there is no leader or there's been nothing heard from the current leader within DEFAULT_LEASE milliseconds else <code>false</code>
 */
boolean amAccepting(Transport.Packet aCollect){
  long myCurrentTime=System.currentTimeMillis();
  if (((Collect)_lastCollect.get().getMessage()).isInitial()) {
    _logger.debug("String_Node_Str");
    return true;
  }
 else {
    if (_leaderUtils.sameLeader(aCollect,_lastCollect.get())) {
      _logger.debug("String_Node_Str");
      return true;
    }
 else     _logger.debug("String_Node_Str" + myCurrentTime + "String_Node_Str"+ _lastLeaderActionTime.get()+ "String_Node_Str"+ Constants.getLeaderLeaseDuration()+ "String_Node_Str"+ (myCurrentTime > _lastLeaderActionTime.get() + Constants.getLeaderLeaseDuration()));
    return (myCurrentTime > _lastLeaderActionTime.get() + Constants.getLeaderLeaseDuration());
  }
}
Program: 87235
Project: 87235
Buggy source:
void leaderAction(){
synchronized (this) {
    _lastLeaderActionTime=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
void leaderAction(){
  _lastLeaderActionTime.set(System.currentTimeMillis());
}
Program: 87236
Project: 87236
Buggy source:
private Leader constructFollowing(){
switch (_outcomes.getLast().getResult()) {
case VoteOutcome.Reason.DECISION:
{
      return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber(),State.BEGIN);
    }
case VoteOutcome.Reason.OTHER_LEADER:
{
    return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber() + 1,State.BEGIN);
  }
case VoteOutcome.Reason.BAD_MEMBERSHIP:
case VoteOutcome.Reason.VOTE_TIMEOUT:
{
  return new Leader(_common,_factory,_outcomes.getLast().getSeqNum(),_outcomes.getLast().getRndNumber(),State.COLLECT);
}
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
private Leader constructFollowing(){
switch (_outcomes.getLast().getResult()) {
case VoteOutcome.Reason.DECISION:
{
      return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber(),State.BEGIN);
    }
case VoteOutcome.Reason.OTHER_LEADER:
{
    return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber() + 1,State.COLLECT);
  }
case VoteOutcome.Reason.BAD_MEMBERSHIP:
case VoteOutcome.Reason.VOTE_TIMEOUT:
{
  return new Leader(_common,_factory,_outcomes.getLast().getSeqNum(),_outcomes.getLast().getRndNumber(),State.COLLECT);
}
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 87237
Project: 87237
Buggy source:
long install(AcceptorLearner.Watermark aLow){
  if (!aLow.equals(AcceptorLearner.Watermark.INITIAL)) {
    _lowSeqNumWatermark=aLow;
    return _lowSeqNumWatermark.getSeqNum();
  }
  return -1;
}

Fixed version (ground truth):
long install(AcceptorLearner.Watermark aLow){
synchronized (this) {
    _lowSeqNumWatermark=aLow;
    return _lowSeqNumWatermark.getSeqNum();
  }
}
Program: 87238
Project: 87238
Buggy source:
private PaxosMessage constructLast(long aSeqNum){
  Watermark myLow=_common.getRecoveryTrigger().getLowWatermark();
  Begin myState;
  try {
    if ((myLow.equals(Watermark.INITIAL)) || (aSeqNum <= myLow.getSeqNum())) {
      myState=new StateFinder(aSeqNum,0).getState();
    }
 else     myState=new StateFinder(aSeqNum,myLow.getLogOffset()).getState();
  }
 catch (  Exception anE) {
    _logger.error("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
  }
  if (myState != null) {
    return new Last(aSeqNum,myLow.getSeqNum(),myState.getRndNumber(),myState.getConsolidatedValue());
  }
 else {
    if (aSeqNum <= myLow.getSeqNum())     return new OldRound(aSeqNum,_common.getLeaderAddress(),_common.getLeaderRndNum());
 else     return new Last(aSeqNum,myLow.getSeqNum(),Long.MIN_VALUE,Proposal.NO_VALUE);
  }
}

Fixed version (ground truth):
/** 
 * @todo BUG: If the leader is out of date, it couldn't currently recover from the OLD_ROUND message becauseit doesn't contain an up-to-date sequence number.
 */
private PaxosMessage constructLast(long aSeqNum){
  Watermark myLow=_common.getRecoveryTrigger().getLowWatermark();
  Begin myState;
  try {
    if ((myLow.equals(Watermark.INITIAL)) || (aSeqNum <= myLow.getSeqNum())) {
      myState=new StateFinder(aSeqNum,0).getState();
    }
 else     myState=new StateFinder(aSeqNum,myLow.getLogOffset()).getState();
  }
 catch (  Exception anE) {
    _logger.error("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
  }
  if (myState != null) {
    return new Last(aSeqNum,myLow.getSeqNum(),myState.getRndNumber(),myState.getConsolidatedValue());
  }
 else {
    if (aSeqNum <= myLow.getSeqNum())     return new OldRound(aSeqNum,_common.getLeaderAddress(),_common.getLeaderRndNum());
 else     return new Last(aSeqNum,myLow.getSeqNum(),Long.MIN_VALUE,Proposal.NO_VALUE);
  }
}
Program: 87239
Project: 87239
Buggy source:
/** 
 * Get the next leader in the chain. Will block until the current leader has reached a stable outcome.
 */
Leader nextLeader(){
synchronized (this) {
    while (!isDone()) {
      try {
        wait();
      }
 catch (      InterruptedException anIE) {
      }
    }
    long mySeqNum=_common.getRecoveryTrigger().getLowWatermark().getSeqNum() + 1;
    long myRndNum=_common.getLeaderRndNum() + 1;
    State myState=State.COLLECT;
switch (_outcomes.getLast().getResult()) {
case VoteOutcome.Reason.DECISION:
{
        myState=State.BEGIN;
        mySeqNum=_outcomes.getLast().getSeqNum() + 1;
        myRndNum=_outcomes.getLast().getRndNumber();
        break;
      }
case VoteOutcome.Reason.OTHER_LEADER:
{
      mySeqNum=_outcomes.getLast().getSeqNum() + 1;
      myRndNum=_outcomes.getLast().getRndNumber() + 1;
      break;
    }
default :
  throw new IllegalStateException("String_Node_Str");
}
return new Leader(_common,_factory,mySeqNum,myRndNum,myState);
}
}

Fixed version (ground truth):
/** 
 * Get the next leader in the chain. Will block until the current leader has reached a stable outcome.
 */
Leader nextLeader(){
synchronized (this) {
    while (!isDone()) {
      try {
        wait();
      }
 catch (      InterruptedException anIE) {
      }
    }
switch (_outcomes.getLast().getResult()) {
case VoteOutcome.Reason.DECISION:
{
        return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber(),State.BEGIN);
      }
case VoteOutcome.Reason.OTHER_LEADER:
{
      return new Leader(_common,_factory,_outcomes.getLast().getSeqNum() + 1,_outcomes.getLast().getRndNumber() + 1,State.BEGIN);
    }
case VoteOutcome.Reason.BAD_MEMBERSHIP:
case VoteOutcome.Reason.VOTE_TIMEOUT:
{
    return new Leader(_common,_factory,_outcomes.getLast().getSeqNum(),_outcomes.getLast().getRndNumber(),State.COLLECT);
  }
default :
throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 87240
Project: 87240
Buggy source:
public boolean routeable(Instance anInstance){
  return ((_lastRound >= anInstance.getRound()) && ((anInstance.getState().equals(Instance.State.BEGIN)) || (anInstance.getState().equals(Instance.State.SUCCESS))));
}

Fixed version (ground truth):
/** 
 * OldRound always indicates a leader is not in charge regardless of sequence number, thus it needn't be attached to a specific sequence number and thus OldRound can contain most recent successful sequence number not the original
 */
public boolean routeable(Instance anInstance){
  return ((_lastRound >= anInstance.getRound()) && ((anInstance.getState().equals(Instance.State.BEGIN)) || (anInstance.getState().equals(Instance.State.SUCCESS))));
}
Program: 87241
Project: 87241
Buggy source:
public long getSeqNum(){
  return _seqNum;
}

Fixed version (ground truth):
/** 
 * Sequence number is always the last one completed (the AL low watermark).
 */
public long getSeqNum(){
  return _seqNum;
}
Program: 87242
Project: 87242
Buggy source:
/** 
 * @todo BUG: If the leader is out of date, it couldn't currently recover from the OLD_ROUND message becauseit doesn't contain an up-to-date sequence number.
 */
private PaxosMessage constructLast(long aSeqNum){
  Watermark myLow=_common.getRecoveryTrigger().getLowWatermark();
  Begin myState;
  try {
    if ((myLow.equals(Watermark.INITIAL)) || (aSeqNum <= myLow.getSeqNum())) {
      myState=new StateFinder(aSeqNum,0).getState();
    }
 else     myState=new StateFinder(aSeqNum,myLow.getLogOffset()).getState();
  }
 catch (  Exception anE) {
    _logger.error("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
  }
  if (myState != null) {
    return new Last(aSeqNum,myLow.getSeqNum(),myState.getRndNumber(),myState.getConsolidatedValue());
  }
 else {
    if (aSeqNum <= myLow.getSeqNum())     return new OldRound(aSeqNum,_common.getLeaderAddress(),_common.getLeaderRndNum());
 else     return new Last(aSeqNum,myLow.getSeqNum(),Long.MIN_VALUE,Proposal.NO_VALUE);
  }
}

Fixed version (ground truth):
private PaxosMessage constructLast(long aSeqNum){
  Watermark myLow=_common.getRecoveryTrigger().getLowWatermark();
  Begin myState;
  try {
    if ((myLow.equals(Watermark.INITIAL)) || (aSeqNum <= myLow.getSeqNum())) {
      myState=new StateFinder(aSeqNum,0).getState();
    }
 else     myState=new StateFinder(aSeqNum,myLow.getLogOffset()).getState();
  }
 catch (  Exception anE) {
    _logger.error("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + _common.getTransport().getLocalAddress(),anE);
  }
  if (myState != null) {
    return new Last(aSeqNum,myLow.getSeqNum(),myState.getRndNumber(),myState.getConsolidatedValue());
  }
 else {
    if (aSeqNum <= myLow.getSeqNum())     return new OldRound(myLow.getSeqNum(),_common.getLeaderAddress(),_common.getLeaderRndNum());
 else     return new Last(aSeqNum,myLow.getSeqNum(),Long.MIN_VALUE,Proposal.NO_VALUE);
  }
}
Program: 87243
Project: 87243
Buggy source:
public void terminate(){
  guard();
  _isStopping.set(true);
synchronized (this) {
    for (    Dispatcher d : _dispatcher)     try {
      d.terminate();
    }
 catch (    Exception anE) {
      _logger.warn("String_Node_Str",anE);
    }
  }
}

Fixed version (ground truth):
public void terminate(){
  guard();
  _isStopping.set(true);
  _factory.destroy(this);
synchronized (this) {
    for (    Dispatcher d : _dispatcher)     try {
      d.terminate();
    }
 catch (    Exception anE) {
      _logger.warn("String_Node_Str",anE);
    }
  }
}
Program: 87245
Project: 87245
Buggy source:
public Map<InetSocketAddress,MetaData> getMemberMap(){
  Map myActives=new HashMap<InetSocketAddress,MetaData>();
synchronized (this) {
    new HashMap<InetSocketAddress,MetaData>(_lastHeartbeats);
  }
  return myActives;
}

Fixed version (ground truth):
public Map<InetSocketAddress,MetaData> getMemberMap(){
  Map myActives;
synchronized (this) {
    myActives=new HashMap<InetSocketAddress,MetaData>(_lastHeartbeats);
  }
  return myActives;
}
Program: 87246
Project: 87246
Buggy source:
@Test public void post() throws Exception {
  ensureFD(_node1.getCommon().getPrivateFD());
  ensureFD(_node2.getCommon().getPrivateFD());
  assert(_node1.getCommon().getFD().getMemberMap().size() == 2);
  assert(_node2.getCommon().getFD().getMemberMap().size() == 2);
  Map<InetSocketAddress,FailureDetector.MetaData> myMembers=_node1.getCommon().getFD().getMemberMap();
  Iterator<Map.Entry<InetSocketAddress,FailureDetector.MetaData>> myMemberIt=myMembers.entrySet().iterator();
  while (myMemberIt.hasNext()) {
    Map.Entry<InetSocketAddress,FailureDetector.MetaData> myEntry=myMemberIt.next();
    if (myEntry.getKey().equals(_tport1.getLocalAddress())) {
      assert("String_Node_Str".equals(new String(myEntry.getValue().getData())));
    }
 else     if (myEntry.getKey().equals(_tport2.getLocalAddress())) {
      assert("String_Node_Str".equals(new String(myEntry.getValue().getData())));
    }
 else {
      Assert.fail();
    }
  }
}

Fixed version (ground truth):
@Test public void post() throws Exception {
  ensureFD(_node1.getCommon().getPrivateFD());
  ensureFD(_node2.getCommon().getPrivateFD());
  Assert.assertTrue(_node1.getCommon().getFD().getMemberMap().size() == 2);
  Assert.assertTrue(_node2.getCommon().getFD().getMemberMap().size() == 2);
  Map<InetSocketAddress,FailureDetector.MetaData> myMembers=_node1.getCommon().getFD().getMemberMap();
  Iterator<Map.Entry<InetSocketAddress,FailureDetector.MetaData>> myMemberIt=myMembers.entrySet().iterator();
  while (myMemberIt.hasNext()) {
    Map.Entry<InetSocketAddress,FailureDetector.MetaData> myEntry=myMemberIt.next();
    if (myEntry.getKey().equals(_tport1.getLocalAddress())) {
      Assert.assertTrue("String_Node_Str".equals(new String(myEntry.getValue().getData())));
    }
 else     if (myEntry.getKey().equals(_tport2.getLocalAddress())) {
      Assert.assertTrue("String_Node_Str".equals(new String(myEntry.getValue().getData())));
    }
 else {
      Assert.fail();
    }
  }
}
Program: 87247
Project: 87247
Buggy source:
/** 
 * When an AL is out of date, call this method to bring it back into sync from a remotely sourced checkpoint.
 * @param aHandle obtained from the remote checkpoint.
 * @throws Exception
 */
public void bringUpToDate(CheckpointHandle aHandle) throws Exception {
  if (!isOutOfDate())   throw new IllegalStateException("String_Node_Str");
  if (!(aHandle instanceof ALCheckpointHandle))   throw new IllegalArgumentException("String_Node_Str" + aHandle);
  ALCheckpointHandle myHandle=(ALCheckpointHandle)aHandle;
  if (myHandle.equals(CheckpointHandle.NO_CHECKPOINT))   throw new IllegalArgumentException("String_Node_Str" + myHandle);
synchronized (this) {
    installCheckpoint(myHandle);
    _storage.mark(myHandle.getLowWatermark().getLogOffset(),true);
    _outOfDate=null;
    _recoveryWindow=null;
    _packetBuffer.clear();
    _cachedBegins.clear();
    _lastLeaderActionTime=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
/** 
 * When an AL is out of date, call this method to bring it back into sync from a remotely sourced checkpoint.
 * @param aHandle obtained from the remote checkpoint.
 * @throws Exception
 */
public void bringUpToDate(CheckpointHandle aHandle) throws Exception {
  if (!isOutOfDate())   throw new IllegalStateException("String_Node_Str");
  if (!(aHandle instanceof ALCheckpointHandle))   throw new IllegalArgumentException("String_Node_Str" + aHandle);
  ALCheckpointHandle myHandle=(ALCheckpointHandle)aHandle;
  if (myHandle.equals(CheckpointHandle.NO_CHECKPOINT))   throw new IllegalArgumentException("String_Node_Str" + myHandle);
synchronized (this) {
    installCheckpoint(myHandle);
    _storage.mark(write(myHandle.getLastCollect(),false),true);
    _outOfDate=null;
    _recoveryWindow=null;
    _packetBuffer.clear();
    _cachedBegins.clear();
    _lastLeaderActionTime=System.currentTimeMillis();
  }
}
Program: 87248
Project: 87248
Buggy source:
public void allReceived(){
  cancelInteraction();
synchronized (this) {
    _tries=0;
    process();
  }
}

Fixed version (ground truth):
public void allReceived(){
synchronized (this) {
    cancelInteraction();
    _tries=0;
    process();
  }
}
Program: 87249
Project: 87249
Buggy source:
private void expired(){
  _logger.info(this + "String_Node_Str");
synchronized (this) {
    if (canRetry()) {
      ++_tries;
      if (_tries < MAX_TRIES) {
        process();
        return;
      }
    }
    error(Event.Reason.VOTE_TIMEOUT);
  }
}

Fixed version (ground truth):
private void expired(){
  _logger.info(this + "String_Node_Str");
synchronized (this) {
    if (canRetry()) {
      ++_tries;
      if (_tries < MAX_TRIES) {
        cancelInteraction();
        process();
        return;
      }
    }
    error(Event.Reason.VOTE_TIMEOUT);
  }
}
Program: 87250
Project: 87250
Buggy source:
public void shutdown(){
  _watchdog.cancel();
}

Fixed version (ground truth):
public void shutdown(){
synchronized (this) {
    _watchdog.cancel();
    if (_membership != null)     _membership.dispose();
    _currentState=States.ABORT;
  }
}
Program: 87251
Project: 87251
Buggy source:
static MessageValidator getValidator(int aLeaderState){
switch (aLeaderState) {
case BEGIN:
    return _beginValidator;
case SUCCESS:
  return _successValidator;
default :
throw new RuntimeException("String_Node_Str" + aLeaderState);
}
}

Fixed version (ground truth):
static MessageValidator getValidator(int aLeaderState){
switch (aLeaderState) {
case BEGIN:
    return _beginValidator;
case SUCCESS:
  return _successValidator;
default :
{
  _logger.warn("String_Node_Str" + aLeaderState);
  return _nullValidator;
}
}
}
Program: 87253
Project: 87253
Buggy source:
/** 
 * @todo If we get ABORT, we could try a new round from scratch or make the client re-submit or .....
 */
public void abort(){
  _logger.info(this + "String_Node_Str");
  cancelInteraction();
synchronized (this) {
    error(Event.Reason.BAD_MEMBERSHIP);
  }
}

Fixed version (ground truth):
/** 
 * @todo If we get ABORT, we could try a new round from scratch or make the client re-submit or .....
 */
public void abort(){
  _logger.info(this + "String_Node_Str");
synchronized (this) {
    error(Event.Reason.BAD_MEMBERSHIP);
  }
}
Program: 87254
Project: 87254
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof Proposal) {
    Proposal myOther=(Proposal)anObject;
    if (myOther.getSize() == getSize()) {
      for (      Map.Entry<String,byte[]> kv : _values.entrySet()) {
        byte[] myOtherVal=myOther.get(kv.getKey());
        if ((myOtherVal == null) || (!compare(myOtherVal,kv.getValue())))         break;
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof Proposal) {
    Proposal myOther=(Proposal)anObject;
    if (myOther.getSize() == getSize()) {
      for (      Map.Entry<String,byte[]> kv : _values.entrySet()) {
        byte[] myOtherVal=myOther.get(kv.getKey());
        if ((myOtherVal == null) || (!compare(myOtherVal,kv.getValue())))         return false;
      }
      return true;
    }
  }
  return false;
}
Program: 87255
Project: 87255
Buggy source:
public void put(String aKey,byte[] aValue){
  _values.put(aKey,aValue);
}

Fixed version (ground truth):
public Proposal put(String aKey,byte[] aValue){
  _values.put(aKey,aValue);
  return this;
}
Program: 87256
Project: 87256
Buggy source:
public boolean sameLeader(Collect aCollect){
  return ((_rndNumber == aCollect._rndNumber) && (_nodeId.equals(aCollect._nodeId)));
}

Fixed version (ground truth):
public boolean sameLeader(Collect aCollect){
  return ((_rndNumber >= aCollect._rndNumber) && (_nodeId.equals(aCollect._nodeId)));
}
Program: 87258
Project: 87258
Buggy source:
@Test public void test() throws Exception {
  HowlLogger myLogger=new HowlLogger(DIRECTORY);
  TransportImpl myTransport=new TransportImpl(_nodeId,_broadcastId);
  AcceptorLearner myAl=new AcceptorLearner(myLogger,new NullFailureDetector(),myTransport,0);
  Assert.assertFalse(myAl.isRecovering());
  long myRndNum=1;
  long mySeqNum=0;
  myAl.messageReceived(new Collect(mySeqNum,myRndNum,_nodeId));
  PaxosMessage myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.LAST);
  byte[] myData=new byte[]{1};
  ConsolidatedValue myValue=new ConsolidatedValue(myData,HANDBACK);
  myAl.messageReceived(new Begin(mySeqNum,myRndNum,myValue,_nodeId));
  myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.ACCEPT);
  myAl.messageReceived(new Success(mySeqNum,myRndNum + 1,myValue,_nodeId));
  myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.ACK);
  myAl.messageReceived(new Collect(mySeqNum + 5,myRndNum + 2,_nodeId));
  Assert.assertTrue(myAl.isRecovering());
  Need myNeed=(Need)myTransport.getNextMsg();
  Assert.assertEquals(myNeed.getNodeId(),myTransport.getLocalAddress());
  Assert.assertEquals(myNeed.getMinSeq(),0);
  Assert.assertEquals(myNeed.getMaxSeq(),mySeqNum + 4);
  myAl.close();
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  HowlLogger myLogger=new HowlLogger(DIRECTORY);
  TransportImpl myTransport=new TransportImpl(_nodeId,_broadcastId);
  AcceptorLearner myAl=new AcceptorLearner(myLogger,new NullFailureDetector(),myTransport,0);
  Assert.assertFalse(myAl.isRecovering());
  long myRndNum=1;
  long mySeqNum=0;
  myAl.messageReceived(new Collect(mySeqNum,myRndNum,_nodeId));
  PaxosMessage myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.LAST);
  byte[] myData=new byte[]{1};
  ConsolidatedValue myValue=new ConsolidatedValue(myData,HANDBACK);
  myAl.messageReceived(new Begin(mySeqNum,myRndNum,myValue,_nodeId));
  myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.ACCEPT);
  myAl.messageReceived(new Success(mySeqNum,myRndNum,myValue,_nodeId));
  myResponse=myTransport.getNextMsg();
  Assert.assertTrue(myResponse.getType() == Operations.ACK);
  myAl.messageReceived(new Collect(mySeqNum + 5,myRndNum + 2,_nodeId));
  Assert.assertTrue(myAl.isRecovering());
  Need myNeed=(Need)myTransport.getNextMsg();
  Assert.assertEquals(myNeed.getNodeId(),myTransport.getLocalAddress());
  Assert.assertEquals(myNeed.getMinSeq(),0);
  Assert.assertEquals(myNeed.getMaxSeq(),mySeqNum + 4);
  myAl.close();
}
Program: 87259
Project: 87259
Buggy source:
public long getNodeId(){
  return 0;
}

Fixed version (ground truth):
public long getNodeId(){
  return _nodeId;
}
Program: 87260
Project: 87260
Buggy source:
public void send(PaxosMessage aMessage,NodeId anAddress){
  PaxosMessage myMessage;
switch (aMessage.getType()) {
case Operations.COLLECT:
case Operations.BEGIN:
case Operations.SUCCESS:
{
      myMessage=new ProposerHeader(aMessage,_addr.getPort());
      break;
    }
default :
{
    myMessage=aMessage;
    break;
  }
}
IoSession mySession=(IoSession)_sessions.get(anAddress);
if (mySession != null) {
try {
  ConnectFuture connFuture=_unicastConnector.connect(NodeId.toAddress(anAddress));
  connFuture.awaitUninterruptibly();
  IoSession myNewSession=connFuture.getSession();
  mySession=_sessions.putIfAbsent(anAddress,myNewSession);
  if (mySession == null)   mySession=myNewSession;
 else {
    myNewSession.close();
  }
}
 catch (Exception anE) {
  throw new RuntimeException("String_Node_Str",anE);
}
}
mySession.write(myMessage);
}

Fixed version (ground truth):
public void send(PaxosMessage aMessage,NodeId anAddress){
  PaxosMessage myMessage;
switch (aMessage.getType()) {
case Operations.COLLECT:
case Operations.BEGIN:
case Operations.SUCCESS:
{
      myMessage=new ProposerHeader(aMessage,_addr.getPort());
      break;
    }
default :
{
    myMessage=aMessage;
    break;
  }
}
IoSession mySession=(IoSession)_sessions.get(anAddress);
if (mySession == null) {
try {
  ConnectFuture connFuture=_unicastConnector.connect(NodeId.toAddress(anAddress));
  connFuture.awaitUninterruptibly();
  IoSession myNewSession=connFuture.getSession();
  mySession=_sessions.putIfAbsent(anAddress,myNewSession);
  if (mySession == null)   mySession=myNewSession;
 else {
    myNewSession.close();
  }
}
 catch (Exception anE) {
  throw new RuntimeException("String_Node_Str",anE);
}
}
mySession.write(myMessage);
}
Program: 87261
Project: 87261
Buggy source:
/** 
 * @param aMessage is an OldRound message received from some other node
 */
private void oldRound(PaxosMessage aMessage){
  failed();
  OldRound myOldRound=(OldRound)aMessage;
  NodeId myCompetingNodeId=NodeId.from(myOldRound.getNodeId());
  updateRndNumber(myOldRound);
  if (myCompetingNodeId.leads(_nodeId)) {
    _logger.info("String_Node_Str" + myCompetingNodeId + "String_Node_Str"+ _nodeId);
    error(Event.Reason.OTHER_LEADER,myCompetingNodeId);
    return;
  }
  _stage=COLLECT;
  process();
}

Fixed version (ground truth):
/** 
 * @todo Fixup the leader conflict behaviour. Right now we'd keep trying and falling down a hole as anotherleader will hold the lease and we'll get silence. But a client potentially resubmits to us because it still thinks we should be leader. We potentially have to check with our on AccepterLearner as to whether it thinks there is another leader (factoring in heartbeat activity) and if there is, redirect the client to  that. Otherwise we could try to become leader. This would allow us to ignore the "superior node" conflict as either clients think we are superior or some other node is and if each time either leader fails the clients need to re-check for a new leader (or we could tell them in the failure message) we'll settle eventually. Note we'll have to review the leader checking tests.
 * @param aMessage is an OldRound message received from some other node
 */
private void oldRound(PaxosMessage aMessage){
  failed();
  OldRound myOldRound=(OldRound)aMessage;
  NodeId myCompetingNodeId=NodeId.from(myOldRound.getNodeId());
  updateRndNumber(myOldRound);
  if (myCompetingNodeId.leads(_nodeId)) {
    _logger.info("String_Node_Str" + myCompetingNodeId + "String_Node_Str"+ _nodeId);
    error(Event.Reason.OTHER_LEADER,myCompetingNodeId);
    return;
  }
  _stage=COLLECT;
  process();
}
Program: 87263
Project: 87263
Buggy source:
public void allReceived(){
  _activeAlarm.cancel();
synchronized (this) {
    process();
  }
}

Fixed version (ground truth):
public void allReceived(){
  _interactionAlarm.cancel();
synchronized (this) {
    process();
  }
}
Program: 87265
Project: 87265
Buggy source:
/** 
 * @todo If we get ABORT, we could try a new round from scratch or make the client re-submit or .....
 */
public void abort(){
  _logger.info("String_Node_Str" + Long.toHexString(_seqNum));
  _activeAlarm.cancel();
synchronized (this) {
    failed();
    error(Reasons.BAD_MEMBERSHIP,null);
  }
}

Fixed version (ground truth):
/** 
 * @todo If we get ABORT, we could try a new round from scratch or make the client re-submit or .....
 */
public void abort(){
  _logger.info("String_Node_Str" + Long.toHexString(_seqNum));
  _interactionAlarm.cancel();
synchronized (this) {
    failed();
    error(Reasons.BAD_MEMBERSHIP,null);
  }
}
Program: 87266
Project: 87266
Buggy source:
private void startInteraction(){
  _activeAlarm=new Alarm();
  _watchdog.schedule(_activeAlarm,_watchdogTimeout);
  _membership.startInteraction();
}

Fixed version (ground truth):
private void startInteraction(){
  _interactionAlarm=new InteractionAlarm();
  _watchdog.schedule(_interactionAlarm,_watchdogTimeout);
  _membership.startInteraction();
}
Program: 87268
Project: 87268
Buggy source:
private void begin(){
  _messages.clear();
  PaxosMessage myMessage=new Begin(++_seqNum,getRndNumber(),_nodeId,_value);
  startInteraction();
  _logger.info("String_Node_Str" + Long.toHexString(_seqNum));
  _transport.send(myMessage,Address.BROADCAST);
}

Fixed version (ground truth):
private void begin(){
  _messages.clear();
  PaxosMessage myMessage=new Begin(_seqNum,getRndNumber(),_nodeId,_value);
  startInteraction();
  _logger.info("String_Node_Str" + Long.toHexString(_seqNum));
  _transport.send(myMessage,Address.BROADCAST);
}
Program: 87269
Project: 87269
Buggy source:
/** 
 * @param aMessage is an OldRound message received from some other node
 */
private void oldRound(PaxosMessage aMessage){
  OldRound myOldRound=(OldRound)aMessage;
  long myCompetingNodeId=myOldRound.getNodeId();
  if (myCompetingNodeId > _nodeId) {
    _logger.info("String_Node_Str" + Long.toHexString(myCompetingNodeId) + "String_Node_Str"+ Long.toHexString(_nodeId));
    notLeader();
    _stage=ABORT;
    _reason=Reasons.OTHER_LEADER;
    process();
    return;
  }
  updateRndNumber(myOldRound);
  _stage=COLLECT;
  collect();
}

Fixed version (ground truth):
/** 
 * @todo We may get oldround after we've sent begin and got some accepts, in such a case we need collect to know that wewere interrupted and the client value has already been submitted and thus doesn't need to be re-run post recovery. Note that any competing leader will first do a collect to increment the round number, it will not yet have proposed a value for a sequence number. Thus if we've received an accept from some node, it has yet to see the new leader and when it does see the leader will return the value we've proposed together with our round number.  Further if we've reached acceptance with our round number, ultimately our value will be used as recovery dictates the value from the highest previous round for a sequence number will be used by the leader.  We have one issue where some acceptor/learner did accept but we didn't get the message and thus can't tell the client value was processed.  What to do?
 * @param aMessage is an OldRound message received from some other node
 */
private void oldRound(PaxosMessage aMessage){
  OldRound myOldRound=(OldRound)aMessage;
  long myCompetingNodeId=myOldRound.getNodeId();
  notLeader();
  if (myCompetingNodeId > _nodeId) {
    _logger.info("String_Node_Str" + Long.toHexString(myCompetingNodeId) + "String_Node_Str"+ Long.toHexString(_nodeId));
    _stage=ABORT;
    _reason=Reasons.OTHER_LEADER;
    process();
    return;
  }
  updateRndNumber(myOldRound);
  _stage=COLLECT;
  process();
}
Program: 87271
Project: 87271
Buggy source:
public void allReceived(){
  _activeAlarm.cancel();
synchronized (this) {
    _stage++;
    process();
  }
}

Fixed version (ground truth):
public void allReceived(){
  _activeAlarm.cancel();
synchronized (this) {
    process();
  }
}
Program: 87272
Project: 87272
Buggy source:
/** 
 * @param aMessage to process
 * @param aSenderAddress at which the sender of this message can be found
 */
public void process(PaxosMessage aMessage,Address aSenderAddress){
switch (aMessage.getType()) {
case Operations.POST:
{
      _logger.info("String_Node_Str");
      LeaderImpl myLeader=_state.newLeader(_transport,aSenderAddress);
      myLeader.messageReceived(aMessage,aSenderAddress);
      break;
    }
case Operations.LAST:
case Operations.ACCEPT:
case Operations.ACK:
{
    LeaderImpl myLeader=_state.getLeader(aMessage.getSeqNum());
    if (myLeader != null)     myLeader.messageReceived(aMessage,aSenderAddress);
 else {
      _logger.warn("String_Node_Str" + aMessage);
    }
    break;
  }
default :
throw new RuntimeException("String_Node_Str" + aMessage.getType());
}
}

Fixed version (ground truth):
/** 
 * @param aMessage to process
 * @param aSenderAddress at which the sender of this message can be found
 */
public void process(PaxosMessage aMessage,Address aSenderAddress){
switch (aMessage.getType()) {
case Operations.POST:
{
      _logger.info("String_Node_Str");
      LeaderImpl myLeader=_state.newLeader(_transport,aSenderAddress);
      myLeader.messageReceived(aMessage,aSenderAddress);
      break;
    }
case Operations.OLDROUND:
case Operations.LAST:
case Operations.ACCEPT:
case Operations.ACK:
{
    LeaderImpl myLeader=_state.getLeader(aMessage.getSeqNum());
    if (myLeader != null)     myLeader.messageReceived(aMessage,aSenderAddress);
 else {
      _logger.warn("String_Node_Str" + aMessage);
    }
    break;
  }
default :
throw new RuntimeException("String_Node_Str" + aMessage.getType());
}
}
Program: 87273
Project: 87273
Buggy source:
public void walkBackward(){
  listener.onStopWalkBackward(this);
  states.add(PlayerState.WALK_BACKWARD);
}

Fixed version (ground truth):
public void walkBackward(){
  listener.onWalkBackward(this);
  states.add(PlayerState.WALK_BACKWARD);
}
Program: 87274
Project: 87274
Buggy source:
public void update(long now){
  if (!activeWindow.isLoaded()) {
    return;
  }
 else   if (needReload) {
    fastReload();
  }
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getViews());
  Context application=activeWindow.getApplication();
  components.add(application);
  updateEffects(now);
  updateApplication(application,now);
  updateActiveWindow(now);
  updateGui(components);
  updateMouse(components);
  keyboard.update(now);
  JoystickLoader.getInstance().update(now);
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}

Fixed version (ground truth):
public void update(long now){
  if (!activeWindow.isLoaded()) {
    return;
  }
 else   if (needReload) {
    fastReload();
  }
  if (Configuration.getInstance().isLanguageChanged()) {
    guiEvents.add(GUIEvent.LANGUAGE_CHANGED);
    Configuration.getInstance().setLanguageChanged(false);
  }
  if (Configuration.getInstance().isThemeChanged()) {
    guiEvents.add(GUIEvent.THEME_CHANGED);
    Configuration.getInstance().setThemeChanged(false);
  }
  superEvent=GUIEvent.NONE;
  List<View> components=new CopyOnWriteArrayList<View>(activeWindow.getViews());
  Context application=activeWindow.getApplication();
  components.add(application);
  updateEffects(now);
  updateApplication(application,now);
  updateActiveWindow(now);
  updateGui(components,guiEvents);
  updateMouse(components);
  keyboard.update(now);
  JoystickLoader.getInstance().update(now);
  if (enableFullScreen) {
    enableFullScreen=false;
    superEvent=GUIEvent.ENABLE_FULL_SCREEN;
  }
  if (disableFullScreen) {
    disableFullScreen=false;
    superEvent=GUIEvent.DISABLE_FULL_SCREEN;
  }
}
Program: 87275
Project: 87275
Buggy source:
private GUIEvent updateMouse(View component,PointerEvent event){
  if (!component.isVisible()) {
    return GUIEvent.NONE;
  }
  if (component.onMouse(event)) {
    if (!component.isMouseOver()) {
      component.setMouseOver(true);
      setMouseOver(component);
    }
  }
 else {
    if (component.isMouseOver()) {
      component.setMouseOver(false);
      resetMouseOver();
    }
  }
  GUIEvent result=component.updateMouse(event);
  if (result != GUIEvent.NONE && result != null) {
    updateEvent(component,result);
    return result;
  }
  for (  View child : component.getViews()) {
    child.setOffset(component.getX(),component.getY());
    updateMouse(child,event);
    child.setOffset(-component.getX(),-component.getY());
  }
  return GUIEvent.NONE;
}

Fixed version (ground truth):
private GUIEvent updateMouse(View component,PointerEvent event){
  if (!component.isVisible()) {
    return GUIEvent.NONE;
  }
  if (component.isMouseOver()) {
    if (component != mouseOver) {
      setMouseOver(component);
    }
  }
 else   if (component == mouseOver) {
    resetMouseOver();
  }
  GUIEvent result=component.updateMouse(event);
  if (result != GUIEvent.NONE && result != null) {
    updateEvent(component,result);
    return result;
  }
  for (  View child : component.getViews()) {
    child.setOffset(component.getX(),component.getY());
    updateMouse(child,event);
    child.setOffset(-component.getX(),-component.getY());
  }
  return GUIEvent.NONE;
}
Program: 87276
Project: 87276
Buggy source:
private void updateGui(List<View> components){
  for (  GUIEvent event : guiEvents) {
    for (    View component : components) {
      updateGuiComponent(component,event);
    }
  }
  guiEvents.clear();
}

Fixed version (ground truth):
private void updateGui(List<View> components,List<GUIEvent> guiEvents){
  for (  GUIEvent event : guiEvents) {
    for (    View component : components) {
      updateGuiComponent(component,event);
    }
  }
  guiEvents.clear();
}
Program: 87277
Project: 87277
Buggy source:
public void draw(Graphic g){
  if (locked || needReload)   return;
  drawWindow(g,activeWindow);
  drawEffects(g);
  if (drawCursor) {
    mouse.draw(g);
  }
}

Fixed version (ground truth):
public void draw(Graphic g){
  if (locked || needReload)   return;
  drawWindow(g,activeWindow);
  drawGlobalEffects(g);
  if (drawCursor) {
    mouse.draw(g);
  }
}
Program: 87278
Project: 87278
Buggy source:
private void drawView(View component,Graphic g){
  if (component.isVisible()) {
    component.draw(g);
    List<View> components=new CopyOnWriteArrayList<View>(component.getViews());
    for (    View child : components) {
      child.setOffset(component.getX(),component.getY());
      drawView(child,g);
      child.setOffset(-component.getX(),-component.getY());
    }
  }
}

Fixed version (ground truth):
private void drawView(View component,Graphic g){
  component.draw(g);
  if (!component.getViews().isEmpty()) {
    List<View> components=new CopyOnWriteArrayList<View>(component.getViews());
    for (    View child : components) {
      child.setOffset(component.getX(),component.getY());
      drawView(child,g);
      child.setOffset(-component.getX(),-component.getY());
    }
  }
}
Program: 87279
Project: 87279
Buggy source:
public HIDController(InputListener listener){
  mouse=new Mouse(0,0);
  keyboard=new Keyboard(listener);
  keyboard.reset();
  joystick=JoystickLoader.getInstance();
  joystick.setListener(listener);
}

Fixed version (ground truth):
public HIDController(InputKeyListener listener){
  mouse=new Mouse(0,0);
  keyboard=new Keyboard(listener);
  keyboard.reset();
  joystick=JoystickLoader.getInstance();
  joystick.setListener(listener);
}
Program: 87280
Project: 87280
Buggy source:
public Keyboard(InputListener listener){
  super();
  this.listener=listener;
}

Fixed version (ground truth):
public Keyboard(InputKeyListener listener){
  super();
  this.listener=listener;
}
Program: 87281
Project: 87281
Buggy source:
public void setListener(InputListener listener){
  this.listener=listener;
}

Fixed version (ground truth):
public void setListener(InputKeyListener listener){
  this.listener=listener;
}
Program: 87282
Project: 87282
Buggy source:
public InputListener getListener(){
  return listener;
}

Fixed version (ground truth):
public InputKeyListener getListener(){
  return listener;
}
Program: 87283
Project: 87283
Buggy source:
public boolean nextFrame(){
  if ((currentFrame < frames - 1) && (currentFrame >= 0)) {
    currentFrame+=inc;
  }
 else {
    if (once) {
      visible=false;
      lockOnce=true;
      setFrame(currentFrame);
    }
 else {
      currentFrame=0;
    }
    return false;
  }
  if (!stopped) {
    setFrame(currentFrame);
  }
  return true;
}

Fixed version (ground truth):
public boolean nextFrame(){
  boolean hasNextFrame=true;
  if ((currentFrame < frames - 1) && (currentFrame >= 0)) {
    currentFrame+=inc;
  }
 else {
    if (once) {
      visible=false;
      lockOnce=true;
    }
 else {
      currentFrame=0;
    }
    hasNextFrame=false;
  }
  if (!stopped) {
    setFrame(currentFrame);
  }
  return hasNextFrame;
}
Program: 87284
Project: 87284
Buggy source:
public void loadApplication(){
  window.setLoaded(false);
  loader=new Loader();
  updater=new Updater();
  Future<?> future=loadExecutor.submit(loader);
  try {
    future.get();
  }
 catch (  ExecutionException e) {
    Throwable cause=e.getCause();
    cause.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  loadExecutor.scheduleAtFixedRate(updater,0,10,TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
public void loadApplication(){
  loadExecutor=Executors.newScheduledThreadPool(2);
  window.setLoaded(false);
  loader=new Loader();
  updater=new Updater();
  future=loadExecutor.submit(loader);
  loadExecutor.scheduleAtFixedRate(updater,0,UPDATE_INTERVAL,TimeUnit.MILLISECONDS);
}
Program: 87285
Project: 87285
Buggy source:
public void run(){
  if (!called) {
    if (!window.isLoaded()) {
      loadApplication.setText(application.getLoadingPhrase(),application.getLoading());
    }
  }
 else {
    window.setApplication(application);
    window.setLoaded(true);
  }
}

Fixed version (ground truth):
public void run(){
  if (!called) {
    if (!window.isLoaded()) {
      loadApplication.setText(application.getLoadingPhrase(),application.getLoading());
    }
  }
 else {
    try {
      future.get();
    }
 catch (    ExecutionException e) {
      Throwable cause=e.getCause();
      cause.printStackTrace();
    }
catch (    InterruptedException e) {
      e.printStackTrace();
    }
    window.setApplication(application);
    window.setLoaded(true);
    loadExecutor.shutdownNow();
  }
}