Program: 130749
Project: 130749
Buggy source:
/** 
 * Gets a message from the queue.
 * @param timeoutMs how to wait before raising a TimeoutException.
 * @return a message tuple contains the message and its source.
 * @throws TimeoutException in case of timeout.
 * @throws InterruptedException it's interrupted.
 */
@Override protected MessageTuple getMessage(int timeoutMs) throws TimeoutException, InterruptedException {
  while (true) {
    MessageTuple tuple=messageQueue.poll(timeoutMs,TimeUnit.MILLISECONDS);
    if (tuple == null) {
      throw new TimeoutException("String_Node_Str");
    }
 else     if (tuple == MessageTuple.GO_BACK) {
      throw new BackToElectionException();
    }
 else     if (tuple.getMessage().getType() == MessageType.ELECTION_INFO) {
      this.election.reply(tuple);
    }
 else     if (tuple.getMessage().getType() == MessageType.DISCONNECTED) {
      Message msg=tuple.getMessage();
      String peerId=msg.getDisconnected().getServerId();
      if (LOG.isDebugEnabled()) {
        LOG.debug("String_Node_Str",TextFormat.shortDebugString(msg));
      }
      if (this.quorumSet.containsKey(peerId)) {
        if (!this.isBroadcasting) {
          LOG.debug("String_Node_Str",peerId);
          throw new BackToElectionException();
        }
 else {
          LOG.debug("String_Node_Str",peerId);
          return tuple;
        }
      }
 else {
        LOG.debug("String_Node_Str",peerId);
        this.transport.clear(peerId);
      }
    }
 else     if (tuple.getMessage().getType() == MessageType.SHUT_DOWN) {
      LOG.debug("String_Node_Str");
      throw new LeftCluster("String_Node_Str");
    }
 else {
      return tuple;
    }
  }
}

Fixed version (ground truth):
/** 
 * Gets a message from the queue.
 * @param timeoutMs how to wait before raising a TimeoutException.
 * @return a message tuple contains the message and its source.
 * @throws TimeoutException in case of timeout.
 * @throws InterruptedException it's interrupted.
 */
@Override protected MessageTuple getMessage(int timeoutMs) throws TimeoutException, InterruptedException {
  while (true) {
    MessageTuple tuple=messageQueue.poll(timeoutMs,TimeUnit.MILLISECONDS);
    if (tuple == null) {
      throw new TimeoutException("String_Node_Str");
    }
 else     if (tuple == MessageTuple.GO_BACK) {
      throw new BackToElectionException();
    }
 else     if (tuple.getMessage().getType() == MessageType.DISCONNECTED) {
      Message msg=tuple.getMessage();
      String peerId=msg.getDisconnected().getServerId();
      if (LOG.isDebugEnabled()) {
        LOG.debug("String_Node_Str",TextFormat.shortDebugString(msg));
      }
      if (this.quorumSet.containsKey(peerId)) {
        if (this.currentPhase != Phase.BROADCASTING) {
          LOG.debug("String_Node_Str",peerId);
          throw new BackToElectionException();
        }
 else {
          LOG.debug("String_Node_Str",peerId);
          return tuple;
        }
      }
 else {
        LOG.debug("String_Node_Str",peerId);
        this.transport.clear(peerId);
      }
    }
 else     if (this.currentPhase != Phase.BROADCASTING && tuple.getMessage().getType() == MessageType.ELECTION_INFO) {
      this.election.reply(tuple);
    }
 else     if (tuple.getMessage().getType() == MessageType.SHUT_DOWN) {
      LOG.debug("String_Node_Str");
      throw new LeftCluster("String_Node_Str");
    }
 else {
      return tuple;
    }
  }
}