Program: 37523
Project: 37523
Buggy source:
@Override public RouteResult route(UserCfg userCfg,List<RedisRequest> requests) throws InvalidRequestExistsException, PhysicalNodeUnavailableException {
  RedisRequest request=requests.get(0);
  KafkaCfg kafkaCfg;
  MetaDataPartition partition;
  if (request.getPolicy().getHandleType() == CommandParse.PRODUCE_CMD) {
    if (request.getNumArgs() != 3) {
      throw new InvalidRequestExistsException("String_Node_Str");
    }
    kafkaCfg=getKafkaCfg(userCfg.getPassword(),request);
    partition=kafkaCfg.getMetaData().getProducerMetaDataPartition();
  }
 else {
    if (request.getNumArgs() != 2 && request.getNumArgs() != 4) {
      throw new InvalidRequestExistsException("String_Node_Str");
    }
    kafkaCfg=getKafkaCfg(userCfg.getPassword(),request);
    if (request.getNumArgs() == 4) {
      int pt=Integer.parseInt(new String(request.getArgs()[2]));
      partition=kafkaCfg.getMetaData().getConsumerMetaDataPartition(pt);
      if (partition == null) {
        throw new InvalidRequestExistsException("String_Node_Str");
      }
    }
 else {
      partition=kafkaCfg.getMetaData().getConsumerMetaDataPartition();
    }
  }
  List<RouteResultNode> nodes=new ArrayList<RouteResultNode>();
  KafkaPool pool=(KafkaPool)RedisEngineCtx.INSTANCE().getPoolMap().get(kafkaCfg.getPoolId());
  RouteResultNode node=new RouteResultNode();
  PhysicalNode physicalNode=pool.getPhysicalNode(partition.getLeader().getId());
  if (physicalNode == null)   throw new PhysicalNodeUnavailableException("String_Node_Str");
  node.setPhysicalNode(physicalNode);
  node.addRequestIndex(0);
  node.setKafkaMetaDataOffset(kafkaCfg.getMetaData().getMetaDataOffsetByPartition(partition.getPartition()));
  nodes.add(node);
  RouteResult routeResult=new RouteResult(RedisRequestType.KAFKA,requests,nodes);
  return routeResult;
}

Fixed version (ground truth):
@Override public RouteResult route(UserCfg userCfg,List<RedisRequest> requests) throws InvalidRequestExistsException, PhysicalNodeUnavailableException {
  RedisRequest request=requests.get(0);
  KafkaCfg kafkaCfg;
  MetaDataPartition partition;
  if (request.getPolicy().getHandleType() == CommandParse.PRODUCE_CMD) {
    if (request.getNumArgs() != 3) {
      throw new InvalidRequestExistsException("String_Node_Str");
    }
    kafkaCfg=getKafkaCfg(userCfg.getPassword(),request,false);
    partition=kafkaCfg.getMetaData().getProducerMetaDataPartition();
  }
 else {
    if (request.getNumArgs() != 2 && request.getNumArgs() != 4) {
      throw new InvalidRequestExistsException("String_Node_Str");
    }
    kafkaCfg=getKafkaCfg(userCfg.getPassword(),request,true);
    if (request.getNumArgs() == 4) {
      int pt=Integer.parseInt(new String(request.getArgs()[2]));
      partition=kafkaCfg.getMetaData().getConsumerMetaDataPartition(pt);
      if (partition == null) {
        throw new InvalidRequestExistsException("String_Node_Str");
      }
    }
 else {
      partition=kafkaCfg.getMetaData().getConsumerMetaDataPartition();
    }
  }
  List<RouteResultNode> nodes=new ArrayList<RouteResultNode>();
  KafkaPool pool=(KafkaPool)RedisEngineCtx.INSTANCE().getPoolMap().get(kafkaCfg.getPoolId());
  RouteResultNode node=new RouteResultNode();
  PhysicalNode physicalNode=pool.getPhysicalNode(partition.getLeader().getId());
  if (physicalNode == null)   throw new PhysicalNodeUnavailableException("String_Node_Str");
  node.setPhysicalNode(physicalNode);
  node.addRequestIndex(0);
  node.setKafkaMetaDataOffset(kafkaCfg.getMetaData().getMetaDataOffsetByPartition(partition.getPartition()));
  nodes.add(node);
  RouteResult routeResult=new RouteResult(RedisRequestType.KAFKA,requests,nodes);
  return routeResult;
}