Program: 87270
Project: 87270
Buggy source:
/** 
 * Do actions for the state we are now in.  Essentially, we're always one state ahead of the participants thus we process the result of a Collect in the BEGIN state which means we expect Last or OldRound and in SUCCESS state we expect ACCEPT or OLDROUND
 * @todo Check Last messages to compute minimum low and maximum high watermarks, then use them to perform recovery
 */
private void process(){
switch (_stage) {
case ABORT:
case EXIT:
{
      _logger.info("String_Node_Str" + _seqNum + "String_Node_Str"+ (_stage == EXIT));
      _membership.dispose();
      if (_stage == EXIT) {
        _transport.send(new Ack(_seqNum),_clientAddress);
      }
 else {
        _transport.send(new Fail(_seqNum,_reason),_clientAddress);
      }
      signalListeners();
      return;
    }
case COLLECT:
{
    collect();
    break;
  }
case BEGIN:
{
  byte[] myValue=_value;
  if (!isLeader()) {
    long myMaxRound=0;
    Iterator<PaxosMessage> myMessages=_messages.iterator();
    while (myMessages.hasNext()) {
      PaxosMessage myMessage=myMessages.next();
      if (myMessage.getType() == Operations.OLDROUND) {
        oldRound(myMessage);
        return;
      }
 else {
        Last myLast=(Last)myMessage;
        if (myLast.getRndNumber() > myMaxRound) {
          myMaxRound=myLast.getRndNumber();
          myValue=myLast.getValue();
        }
      }
    }
  }
  amLeader();
  _value=myValue;
  if (_seqNum == LogStorage.EMPTY_LOG) {
    _seqNum=-1;
  }
  begin();
  break;
}
case SUCCESS:
{
int myAcceptCount=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
  PaxosMessage myMessage=myMessages.next();
  if (myMessage.getType() == Operations.OLDROUND) {
    oldRound(myMessage);
    return;
  }
 else {
    myAcceptCount++;
  }
}
if (myAcceptCount >= _membership.getMajority()) {
  success();
}
 else {
  _stage=BEGIN;
  begin();
}
break;
}
default :
throw new RuntimeException("String_Node_Str" + _stage);
}
}

Fixed version (ground truth):
/** 
 * Do actions for the state we are now in.  Essentially, we're always one state ahead of the participants thus we process the result of a Collect in the BEGIN state which means we expect Last or OldRound and in SUCCESS state we expect ACCEPT or OLDROUND
 * @todo Check Last messages to compute minimum low and maximum high watermarks, then use them to perform recovery
 * @todo Ensure during recovery that BEGIN doesn't screw up the sequence number - perhaps during recovery prevent BEGIN from doingsequence number increments
 * @todo Handle all cases in SUCCEESS e.g. we don't properly process/wait for all Acks
 */
private void process(){
switch (_stage) {
case ABORT:
case EXIT:
{
      _logger.info("String_Node_Str" + _seqNum + "String_Node_Str"+ (_stage == EXIT));
      _membership.dispose();
      if (_stage == EXIT) {
        _transport.send(new Ack(_seqNum),_clientAddress);
      }
 else {
        _transport.send(new Fail(_seqNum,_reason),_clientAddress);
      }
      signalListeners();
      return;
    }
case COLLECT:
{
    collect();
    _stage=BEGIN;
    break;
  }
case BEGIN:
{
  byte[] myValue=_value;
  if (!isLeader()) {
    long myMaxRound=0;
    Iterator<PaxosMessage> myMessages=_messages.iterator();
    while (myMessages.hasNext()) {
      PaxosMessage myMessage=myMessages.next();
      if (myMessage.getType() == Operations.OLDROUND) {
        oldRound(myMessage);
        return;
      }
 else {
        Last myLast=(Last)myMessage;
        if (myLast.getRndNumber() > myMaxRound) {
          myMaxRound=myLast.getRndNumber();
          myValue=myLast.getValue();
        }
      }
    }
  }
  amLeader();
  _value=myValue;
  if (_seqNum == LogStorage.EMPTY_LOG) {
    _seqNum=-1;
  }
  begin();
  _stage=SUCCESS;
  break;
}
case SUCCESS:
{
int myAcceptCount=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
  PaxosMessage myMessage=myMessages.next();
  if (myMessage.getType() == Operations.OLDROUND) {
    oldRound(myMessage);
    return;
  }
 else {
    myAcceptCount++;
  }
}
if (myAcceptCount >= _membership.getMajority()) {
  success();
  _stage=EXIT;
}
 else {
  begin();
  _stage=SUCCESS;
}
break;
}
default :
throw new RuntimeException("String_Node_Str" + _stage);
}
}