Program: 37534
Project: 37534
Buggy source:
protected List<RouteResultNode> doSharding(int poolId,List<RedisRequest> requests,List<RedisRequestPolicy> requestPolicys) throws PhysicalNodeUnavailableException {
  List<RouteResultNode> nodes=new ArrayList<RouteResultNode>();
  AbstractPool pool=RedisEngineCtx.INSTANCE().getPoolMap().get(poolId);
  if (pool.getType() == 0) {
    RouteResultNode node=new RouteResultNode();
    PhysicalNode physicalNode=pool.getPhysicalNode();
    if (physicalNode == null)     throw new PhysicalNodeUnavailableException("String_Node_Str");
    node.setPhysicalNode(physicalNode);
    for (int i=0; i < requests.size(); i++) {
      node.addRequestIndex(i);
    }
    node.setPhysicalNode(pool.getPhysicalNode());
    nodes.add(node);
  }
 else   if (pool.getType() == 1) {
    RedisClusterPool clusterPool=(RedisClusterPool)pool;
    for (int i=0; i < requests.size(); i++) {
      if (requestPolicys.get(i).getLevel() == CommandParse.AUTO_RESP_CMD) {
        continue;
      }
      int slot=0;
      RedisRequest request=requests.get(i);
      byte[] requestKey=request.getNumArgs() > 1 ? request.getArgs()[1] : null;
      if (requestKey != null) {
        slot=ClusterCRC16Util.getSlot(requestKey,false);
      }
      PhysicalNode physicalNode=clusterPool.getPhysicalNodeBySlot(slot);
      if (physicalNode == null)       throw new PhysicalNodeUnavailableException("String_Node_Str");
      arrangePhyNode(nodes,i,physicalNode);
    }
  }
 else   if (pool.getType() == 2) {
    RedisCustomClusterPool ccPool=(RedisCustomClusterPool)pool;
    for (int i=0; i < requests.size(); i++) {
      if (requestPolicys.get(i).getLevel() == CommandParse.AUTO_RESP_CMD) {
        continue;
      }
      RedisRequest request=requests.get(i);
      PhysicalNode physicalNode=ccPool.getPhysicalNode(request);
      arrangePhyNode(nodes,i,physicalNode);
    }
  }
  return nodes;
}

Fixed version (ground truth):
protected List<RouteResultNode> doSharding(int poolId,List<RedisRequest> requests,List<RedisRequestPolicy> requestPolicys) throws PhysicalNodeUnavailableException {
  List<RouteResultNode> nodes=new ArrayList<RouteResultNode>();
  AbstractPool pool=RedisEngineCtx.INSTANCE().getPoolMap().get(poolId);
  if (pool.getType() == 0) {
    RouteResultNode node=new RouteResultNode();
    PhysicalNode physicalNode=pool.getPhysicalNode();
    if (physicalNode == null)     throw new PhysicalNodeUnavailableException("String_Node_Str");
    node.setPhysicalNode(physicalNode);
    for (int i=0; i < requests.size(); i++) {
      node.addRequestIndex(i);
    }
    node.setPhysicalNode(pool.getPhysicalNode());
    nodes.add(node);
  }
 else   if (pool.getType() == 1) {
    RedisClusterPool clusterPool=(RedisClusterPool)pool;
    for (int i=0; i < requests.size(); i++) {
      if (requestPolicys.get(i).getLevel() == CommandParse.AUTO_RESP_CMD) {
        continue;
      }
      int slot=0;
      RedisRequest request=requests.get(i);
      byte[] requestKey=request.getNumArgs() > 1 ? request.getArgs()[1] : null;
      if (requestKey != null) {
        slot=ClusterCRC16Util.getSlot(requestKey);
      }
      PhysicalNode physicalNode=clusterPool.getPhysicalNodeBySlot(slot);
      if (physicalNode == null)       throw new PhysicalNodeUnavailableException("String_Node_Str");
      arrangePhyNode(nodes,i,physicalNode);
    }
  }
 else   if (pool.getType() == 2) {
    RedisCustomClusterPool ccPool=(RedisCustomClusterPool)pool;
    for (int i=0; i < requests.size(); i++) {
      if (requestPolicys.get(i).getLevel() == CommandParse.AUTO_RESP_CMD) {
        continue;
      }
      RedisRequest request=requests.get(i);
      PhysicalNode physicalNode=ccPool.getPhysicalNode(request);
      arrangePhyNode(nodes,i,physicalNode);
    }
  }
  return nodes;
}