Program: 175696
Project: 175696
Buggy source:
public static void main(String[] args){
  GlobalConf conf=GlobalConf.getInstance();
  RaftMessage.Server localServer=conf.getLocalServer();
  List<RaftMessage.Server> servers=conf.getServers();
  String dataDir=conf.getDataDir();
  ZKConf zkConf=conf.getZkConf();
  MetadataManager metadataManager=new MetadataManager(zkConf);
  RPCServer server=new RPCServer(localServer.getEndPoint().getPort());
  BrokerStateMachine stateMachine=new BrokerStateMachine();
  RaftOptions.dataDir=dataDir;
  RaftOptions.snapshotMinLogSize=10 * 1024;
  RaftOptions.snapshotPeriodSeconds=30;
  RaftOptions.maxSegmentFileSize=1024 * 1024;
  RaftNode raftNode=new RaftNode(servers,localServer,stateMachine);
  stateMachine.setRaftNode(raftNode);
  RaftConsensusService raftConsensusService=new RaftConsensusServiceImpl(raftNode);
  server.registerService(raftConsensusService);
  RaftClientService raftClientService=new RaftClientServiceImpl(raftNode);
  server.registerService(raftClientService);
  BrokerAPIImpl brokerAPI=new BrokerAPIImpl(raftNode,stateMachine,metadataManager);
  server.registerService(brokerAPI);
  server.start();
  raftNode.init();
  metadataManager.subscribeTopic();
  while (!ConfigurationUtils.containsServer(raftNode.getConfiguration(),conf.getLocalServer().getServerId())) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException ex) {
      ex.printStackTrace();
    }
  }
  metadataManager.registerBroker(conf.getShardingId(),conf.getLocalServer().getEndPoint().getHost(),conf.getLocalServer().getEndPoint().getPort());
}

Fixed version (ground truth):
public static void main(String[] args){
  GlobalConf conf=GlobalConf.getInstance();
  RaftMessage.Server localServer=conf.getLocalServer();
  List<RaftMessage.Server> servers=conf.getServers();
  String dataDir=System.getProperty("String_Node_Str") + File.separator + conf.getDataDir();
  ZKConf zkConf=conf.getZkConf();
  MetadataManager metadataManager=new MetadataManager(zkConf);
  RPCServer server=new RPCServer(localServer.getEndPoint().getPort());
  BrokerStateMachine stateMachine=new BrokerStateMachine(dataDir);
  RaftOptions.dataDir=dataDir;
  RaftOptions.snapshotMinLogSize=10 * 1024;
  RaftOptions.snapshotPeriodSeconds=30;
  RaftOptions.maxSegmentFileSize=1024 * 1024;
  RaftNode raftNode=new RaftNode(servers,localServer,stateMachine);
  stateMachine.setRaftNode(raftNode);
  RaftConsensusService raftConsensusService=new RaftConsensusServiceImpl(raftNode);
  server.registerService(raftConsensusService);
  RaftClientService raftClientService=new RaftClientServiceImpl(raftNode);
  server.registerService(raftClientService);
  BrokerAPIImpl brokerAPI=new BrokerAPIImpl(raftNode,stateMachine,metadataManager);
  server.registerService(brokerAPI);
  server.start();
  raftNode.init();
  metadataManager.subscribeTopic();
  while (!ConfigurationUtils.containsServer(raftNode.getConfiguration(),conf.getLocalServer().getServerId())) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException ex) {
      ex.printStackTrace();
    }
  }
  metadataManager.registerBroker(conf.getShardingId(),conf.getLocalServer().getEndPoint().getHost(),conf.getLocalServer().getEndPoint().getPort());
}