Program: 130725
Project: 130725
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.PROPOSED_EPOCH) {
      LOG.debug("String_Node_Str");
      this.transport.clear(tuple.getServerId());
    }
 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.electedLeader != null && peerId.equals(this.electedLeader)) {
        LOG.debug("String_Node_Str",this.electedLeader);
        throw new BackToElectionException();
      }
 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;
    }
  }
}

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 {
  long startTime=System.nanoTime() / 1000000;
  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.PROPOSED_EPOCH) {
      LOG.debug("String_Node_Str");
      this.transport.clear(tuple.getServerId());
    }
 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.electedLeader != null && peerId.equals(this.electedLeader)) {
        LOG.debug("String_Node_Str",this.electedLeader);
        throw new BackToElectionException();
      }
 else {
        LOG.debug("String_Node_Str",peerId);
        this.transport.clear(peerId);
      }
    }
 else     if (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;
    }
    long curTime=System.nanoTime() / 1000000;
    if (curTime - startTime >= (long)timeoutMs) {
      throw new TimeoutException();
    }
  }
}