Program: 50322
Project: 50322
Buggy source:
private void joinViaPossibleMembers(){
  try {
    failedConnections.clear();
    final Collection<Address> colPossibleAddresses=getPossibleMembers();
    colPossibleAddresses.remove(address);
    for (    final Address possibleAddress : colPossibleAddresses) {
      logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
      connectionManager.getOrConnect(possibleAddress);
    }
    boolean found=false;
    int numberOfSeconds=0;
    final int connectionTimeoutSeconds=config.getNetworkConfig().getJoin().getTcpIpConfig().getConnectionTimeoutSeconds();
    while (!found && numberOfSeconds < connectionTimeoutSeconds) {
      colPossibleAddresses.removeAll(failedConnections);
      if (colPossibleAddresses.size() == 0) {
        break;
      }
      Thread.sleep(1000);
      numberOfSeconds++;
      int numberOfJoinReq=0;
      logger.log(Level.FINE,"String_Node_Str");
      for (      Address possibleAddress : colPossibleAddresses) {
        logger.log(Level.FINEST,"String_Node_Str" + numberOfJoinReq + "String_Node_Str"+ possibleAddress);
        final Connection conn=connectionManager.getOrConnect(possibleAddress);
        if (conn != null && numberOfJoinReq < 5) {
          found=true;
          logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
          clusterManager.sendJoinRequest(possibleAddress);
          numberOfJoinReq++;
        }
 else {
          logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
        }
      }
    }
    logger.log(Level.FINEST,"String_Node_Str" + found);
    if (!found) {
      logger.log(Level.FINEST,"String_Node_Str");
      setAsMaster();
    }
 else {
      while (!joined) {
        int numberOfJoinReq=0;
        colPossibleAddresses.removeAll(failedConnections);
        for (        Address possibleAddress : colPossibleAddresses) {
          final Connection conn=connectionManager.getOrConnect(possibleAddress);
          if (conn != null && numberOfJoinReq < 5) {
            logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
            clusterManager.sendJoinRequest(possibleAddress);
            numberOfJoinReq++;
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + possibleAddress + "String_Node_Str");
          }
        }
        Thread.sleep(2000);
        if (masterAddress == null) {
          boolean masterCandidate=true;
          for (          Address address : colPossibleAddresses) {
            if (this.address.hashCode() > address.hashCode()) {
              masterCandidate=false;
            }
          }
          if (masterCandidate) {
            logger.log(Level.FINEST,"String_Node_Str");
            setAsMaster();
          }
        }
      }
    }
    colPossibleAddresses.clear();
    failedConnections.clear();
  }
 catch (  Exception e) {
    e.printStackTrace();
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
}

Fixed version (ground truth):
private void joinViaPossibleMembers(){
  try {
    failedConnections.clear();
    final Collection<Address> colPossibleAddresses=getPossibleMembers();
    colPossibleAddresses.remove(address);
    for (    final Address possibleAddress : colPossibleAddresses) {
      logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
      connectionManager.getOrConnect(possibleAddress);
    }
    boolean found=false;
    int numberOfSeconds=0;
    final int connectionTimeoutSeconds=config.getNetworkConfig().getJoin().getTcpIpConfig().getConnectionTimeoutSeconds();
    while (!found && numberOfSeconds < connectionTimeoutSeconds) {
      colPossibleAddresses.removeAll(failedConnections);
      if (colPossibleAddresses.size() == 0) {
        break;
      }
      Thread.sleep(1000L);
      numberOfSeconds++;
      int numberOfJoinReq=0;
      logger.log(Level.FINE,"String_Node_Str");
      for (      Address possibleAddress : colPossibleAddresses) {
        logger.log(Level.FINEST,"String_Node_Str" + numberOfJoinReq + "String_Node_Str"+ possibleAddress);
        final Connection conn=connectionManager.getOrConnect(possibleAddress);
        if (conn != null && numberOfJoinReq < 5) {
          found=true;
          logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
          clusterManager.sendJoinRequest(possibleAddress);
          numberOfJoinReq++;
        }
 else {
          logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
        }
      }
    }
    logger.log(Level.FINEST,"String_Node_Str" + found);
    if (!found) {
      logger.log(Level.FINEST,"String_Node_Str");
      setAsMaster();
    }
 else {
      while (!joined) {
        int numberOfJoinReq=0;
        colPossibleAddresses.removeAll(failedConnections);
        for (        Address possibleAddress : colPossibleAddresses) {
          final Connection conn=connectionManager.getOrConnect(possibleAddress);
          if (conn != null && numberOfJoinReq < 5) {
            logger.log(Level.FINEST,"String_Node_Str" + possibleAddress);
            clusterManager.sendJoinRequest(possibleAddress);
            numberOfJoinReq++;
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + possibleAddress + "String_Node_Str");
          }
        }
        long sleepTime=3000L;
        for (        Address possibleAddress : colPossibleAddresses) {
          if (address.hashCode() > possibleAddress.hashCode()) {
            sleepTime=6000L;
            break;
          }
 else           if (address.hashCode() == possibleAddress.hashCode()) {
            sleepTime=3000L + ((int)(Math.random() * 10) * 1000L);
            break;
          }
        }
        Thread.sleep(sleepTime);
        if (masterAddress == null) {
          boolean masterCandidate=true;
          for (          Address address : colPossibleAddresses) {
            if (this.address.hashCode() > address.hashCode()) {
              masterCandidate=false;
            }
          }
          if (masterCandidate) {
            logger.log(Level.FINEST,"String_Node_Str");
            setAsMaster();
          }
        }
      }
    }
    colPossibleAddresses.clear();
    failedConnections.clear();
  }
 catch (  Exception e) {
    e.printStackTrace();
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
}