Program: 175708
Project: 175708
Buggy source:
@Override public BrokerMessage.SendMessageResponse sendMessage(BrokerMessage.SendMessageRequest request){
  BrokerMessage.SendMessageResponse.Builder responseBuilder=BrokerMessage.SendMessageResponse.newBuilder();
  BrokerMessage.BaseResponse.Builder baseResBuilder=BrokerMessage.BaseResponse.newBuilder();
  baseResBuilder.setResCode(BrokerMessage.ResCode.RES_CODE_FAIL);
  ZKData zkData=ZKData.getInstance();
  Map<String,Map<Integer,Integer>> topicMap=zkData.getTopicMap();
  Map<Integer,Integer> queueMap=topicMap.get(request.getTopic());
  if (queueMap == null) {
    String message="String_Node_Str";
    baseResBuilder.setResMsg(message);
    responseBuilder.setBaseRes(baseResBuilder.build());
    LOG.info("String_Node_Str",request.getTopic(),request.getQueue(),responseBuilder.getBaseRes().getResCode(),responseBuilder.getBaseRes().getResMsg());
    return responseBuilder.build();
  }
  GlobalConf conf=GlobalConf.getInstance();
  Integer shardingId=queueMap.get(request.getQueue());
  if (shardingId == null || shardingId != conf.getShardingId()) {
    String message="String_Node_Str";
    baseResBuilder.setResMsg(message);
    responseBuilder.setBaseRes(baseResBuilder.build());
    LOG.info("String_Node_Str",request.getTopic(),request.getQueue(),responseBuilder.getBaseRes().getResCode(),responseBuilder.getBaseRes().getResMsg());
    return responseBuilder.build();
  }
  if (raftNode.getLeaderId() <= 0) {
    baseResBuilder.setResMsg("String_Node_Str");
    responseBuilder.setBaseRes(baseResBuilder);
  }
 else   if (raftNode.getLeaderId() != raftNode.getLocalServer().getServerId()) {
    RPCClient rpcClient=raftNode.getPeerMap().get(raftNode.getLeaderId()).getRpcClient();
    BrokerAPI brokerAPI=RPCProxy.getProxy(rpcClient,BrokerAPI.class);
    BrokerMessage.SendMessageResponse responseFromLeader=brokerAPI.sendMessage(request);
    responseBuilder.mergeFrom(responseFromLeader);
  }
 else {
    byte[] data=request.toByteArray();
    boolean success=raftNode.replicate(data,RaftMessage.EntryType.ENTRY_TYPE_DATA);
    baseResBuilder.setResCode(success ? BrokerMessage.ResCode.RES_CODE_SUCCESS : BrokerMessage.ResCode.RES_CODE_FAIL);
    responseBuilder.setBaseRes(baseResBuilder);
  }
  BrokerMessage.SendMessageResponse response=responseBuilder.build();
  LOG.info("String_Node_Str",request.getTopic(),request.getQueue(),responseBuilder.getBaseRes().getResCode(),responseBuilder.getBaseRes().getResMsg());
  return response;
}

Fixed version (ground truth):
@Override public BrokerMessage.SendMessageResponse sendMessage(BrokerMessage.SendMessageRequest request){
  BrokerMessage.SendMessageResponse.Builder responseBuilder=BrokerMessage.SendMessageResponse.newBuilder();
  BrokerMessage.BaseResponse.Builder baseResBuilder=BrokerMessage.BaseResponse.newBuilder();
  baseResBuilder.setResCode(BrokerMessage.ResCode.RES_CODE_FAIL);
  ZKData zkData=ZKData.getInstance();
  GlobalConf conf=GlobalConf.getInstance();
  zkData.getTopicLock().lock();
  Map<String,Map<Integer,Integer>> topicMap=zkData.getTopicMap();
  Map<Integer,Integer> queueMap=topicMap.get(request.getTopic());
  if (queueMap == null || !queueMap.containsKey(request.getQueue()) || queueMap.get(request.getQueue()) != conf.getShardingId()) {
    queueMap=zkClient.readTopicInfo(request.getTopic());
    zkData.getTopicLock().lock();
    try {
      zkData.getTopicMap().put(request.getTopic(),queueMap);
    }
  finally {
      zkData.getTopicLock().unlock();
    }
    if (queueMap == null || !queueMap.containsKey(request.getQueue()) || queueMap.get(request.getQueue()) != conf.getShardingId()) {
      String message="String_Node_Str";
      baseResBuilder.setResMsg(message);
      responseBuilder.setBaseRes(baseResBuilder.build());
      LOG.info("String_Node_Str",request.getTopic(),request.getQueue(),responseBuilder.getBaseRes().getResCode(),responseBuilder.getBaseRes().getResMsg());
      return responseBuilder.build();
    }
  }
  if (raftNode.getLeaderId() <= 0) {
    baseResBuilder.setResMsg("String_Node_Str");
    responseBuilder.setBaseRes(baseResBuilder);
  }
 else   if (raftNode.getLeaderId() != raftNode.getLocalServer().getServerId()) {
    RPCClient rpcClient=raftNode.getPeerMap().get(raftNode.getLeaderId()).getRpcClient();
    BrokerAPI brokerAPI=RPCProxy.getProxy(rpcClient,BrokerAPI.class);
    BrokerMessage.SendMessageResponse responseFromLeader=brokerAPI.sendMessage(request);
    responseBuilder.mergeFrom(responseFromLeader);
  }
 else {
    byte[] data=request.toByteArray();
    boolean success=raftNode.replicate(data,RaftMessage.EntryType.ENTRY_TYPE_DATA);
    baseResBuilder.setResCode(success ? BrokerMessage.ResCode.RES_CODE_SUCCESS : BrokerMessage.ResCode.RES_CODE_FAIL);
    responseBuilder.setBaseRes(baseResBuilder);
  }
  BrokerMessage.SendMessageResponse response=responseBuilder.build();
  LOG.info("String_Node_Str",request.getTopic(),request.getQueue(),responseBuilder.getBaseRes().getResCode(),responseBuilder.getBaseRes().getResMsg());
  return response;
}