Program: 31939
Project: 31939
Buggy source:
private DTMasterParams buildInitialMasterParams(){
  Map<Integer,TreeNode> todoNodes=new HashMap<Integer,TreeNode>(treeNum,1.0f);
  int nodeIndexInGroup=0;
  List<Integer> depthList=new ArrayList<Integer>();
  DTMasterParams masterParams=new DTMasterParams(trees,todoNodes);
  if (isRF) {
    for (int i=0; i < this.treeNum; i++) {
      depthList.add(-1);
    }
    for (    TreeNode treeNode : trees) {
      List<Integer> features=getSubsamplingFeatures(this.featureSubsetStrategy);
      treeNode.setFeatures(features);
      todoNodes.put(nodeIndexInGroup,treeNode);
      int treeId=treeNode.getTreeId();
      int oldDepth=depthList.get(treeId);
      int currDepth=Node.indexToLevel(treeNode.getNode().getId());
      if (currDepth > oldDepth) {
        depthList.set(treeId,currDepth);
      }
      nodeIndexInGroup+=1;
    }
    masterParams.setTrees(this.trees);
  }
 else   if (isGBDT) {
    depthList.add(-1);
    List<Integer> features=getSubsamplingFeatures(this.featureSubsetStrategy);
    TreeNode treeNode=trees.get(trees.size() - 1);
    treeNode.setFeatures(features);
    todoNodes.put(nodeIndexInGroup,treeNode);
    int oldDepth=depthList.get(0);
    int currDepth=Node.indexToLevel(treeNode.getNode().getId());
    if (currDepth > oldDepth) {
      depthList.set(0,currDepth);
    }
    nodeIndexInGroup+=1;
    masterParams.setContinuousRunningStart(this.isContinuousEnabled);
    masterParams.setSwitchToNextTree(true);
    masterParams.setFirstTree(this.trees.size() == 1);
    if (this.trees.size() > 0) {
      masterParams.setTrees(this.trees.subList(this.trees.size() - 1,this.trees.size()));
    }
    masterParams.setTmpTrees(this.trees);
  }
  masterParams.setTreeDepth(depthList);
  return masterParams;
}

Fixed version (ground truth):
private DTMasterParams buildInitialMasterParams(){
  Map<Integer,TreeNode> todoNodes=new HashMap<Integer,TreeNode>(treeNum,1.0f);
  int nodeIndexInGroup=0;
  List<Integer> depthList=new ArrayList<Integer>();
  DTMasterParams masterParams=new DTMasterParams(trees,todoNodes);
  if (isRF) {
    for (int i=0; i < this.treeNum; i++) {
      depthList.add(-1);
    }
    for (    TreeNode treeNode : trees) {
      List<Integer> features=getSubsamplingFeatures(this.featureSubsetStrategy,this.featureSubsetRate);
      treeNode.setFeatures(features);
      todoNodes.put(nodeIndexInGroup,treeNode);
      int treeId=treeNode.getTreeId();
      int oldDepth=depthList.get(treeId);
      int currDepth=Node.indexToLevel(treeNode.getNode().getId());
      if (currDepth > oldDepth) {
        depthList.set(treeId,currDepth);
      }
      nodeIndexInGroup+=1;
    }
    masterParams.setTrees(this.trees);
  }
 else   if (isGBDT) {
    depthList.add(-1);
    List<Integer> features=getSubsamplingFeatures(this.featureSubsetStrategy,this.featureSubsetRate);
    TreeNode treeNode=trees.get(trees.size() - 1);
    treeNode.setFeatures(features);
    todoNodes.put(nodeIndexInGroup,treeNode);
    int oldDepth=depthList.get(0);
    int currDepth=Node.indexToLevel(treeNode.getNode().getId());
    if (currDepth > oldDepth) {
      depthList.set(0,currDepth);
    }
    nodeIndexInGroup+=1;
    masterParams.setContinuousRunningStart(this.isContinuousEnabled);
    masterParams.setSwitchToNextTree(true);
    masterParams.setFirstTree(this.trees.size() == 1);
    if (this.trees.size() > 0) {
      masterParams.setTrees(this.trees.subList(this.trees.size() - 1,this.trees.size()));
    }
    masterParams.setTmpTrees(this.trees);
  }
  masterParams.setTreeDepth(depthList);
  return masterParams;
}