Program: 162796
Project: 162796
Buggy source:
@Override public PMML buildModel(JavaSparkContext sparkContext,JavaRDD<String> trainData,List<?> hyperParameters,Path candidatePath){
  int maxSplitCandidates=(Integer)hyperParameters.get(0);
  int maxDepth=(Integer)hyperParameters.get(1);
  String impurity=(String)hyperParameters.get(2);
  Preconditions.checkArgument(maxSplitCandidates > 0);
  Preconditions.checkArgument(maxDepth > 0);
  JavaRDD<String[]> parsedRDD=trainData.map(MLFunctions.PARSE_FN);
  CategoricalValueEncodings categoricalValueEncodings=new CategoricalValueEncodings(getDistinctValues(parsedRDD));
  JavaRDD<LabeledPoint> trainPointData=parseToLabeledPointRDD(parsedRDD,categoricalValueEncodings);
  Map<Integer,Integer> categoryInfo=categoricalValueEncodings.getCategoryCounts();
  categoryInfo.remove(inputSchema.getTargetFeatureIndex());
  int seed=RandomManager.getRandom().nextInt();
  RandomForestModel model;
  if (inputSchema.isClassification()) {
    int numTargetClasses=categoricalValueEncodings.getValueCount(inputSchema.getTargetFeatureIndex());
    model=RandomForest.trainClassifier(trainPointData,numTargetClasses,categoryInfo,numTrees,"String_Node_Str",impurity,maxDepth,maxSplitCandidates,seed);
  }
 else {
    model=RandomForest.trainRegressor(trainPointData,categoryInfo,numTrees,"String_Node_Str",impurity,maxDepth,maxSplitCandidates,seed);
  }
  List<Map<Integer,Long>> treeNodeIDCounts=treeNodeExampleCounts(trainPointData,model);
  Map<Integer,Long> predictorIndexCounts=predictorExampleCounts(trainPointData,model);
  return rdfModelToPMML(model,categoricalValueEncodings,maxDepth,maxSplitCandidates,impurity,treeNodeIDCounts,predictorIndexCounts);
}

Fixed version (ground truth):
@Override public PMML buildModel(JavaSparkContext sparkContext,JavaRDD<String> trainData,List<?> hyperParameters,Path candidatePath){
  int maxSplitCandidates=(Integer)hyperParameters.get(0);
  int maxDepth=(Integer)hyperParameters.get(1);
  String impurity=(String)hyperParameters.get(2);
  Preconditions.checkArgument(maxSplitCandidates >= 2,"String_Node_Str");
  Preconditions.checkArgument(maxDepth > 0,"String_Node_Str");
  JavaRDD<String[]> parsedRDD=trainData.map(MLFunctions.PARSE_FN);
  CategoricalValueEncodings categoricalValueEncodings=new CategoricalValueEncodings(getDistinctValues(parsedRDD));
  JavaRDD<LabeledPoint> trainPointData=parseToLabeledPointRDD(parsedRDD,categoricalValueEncodings);
  Map<Integer,Integer> categoryInfo=categoricalValueEncodings.getCategoryCounts();
  categoryInfo.remove(inputSchema.getTargetFeatureIndex());
  Map<Integer,Integer> categoryInfoByPredictor=new HashMap<>(categoryInfo.size());
  for (  Map.Entry<Integer,Integer> e : categoryInfo.entrySet()) {
    categoryInfoByPredictor.put(inputSchema.featureToPredictorIndex(e.getKey()),e.getValue());
  }
  int seed=RandomManager.getRandom().nextInt();
  RandomForestModel model;
  if (inputSchema.isClassification()) {
    int numTargetClasses=categoricalValueEncodings.getValueCount(inputSchema.getTargetFeatureIndex());
    model=RandomForest.trainClassifier(trainPointData,numTargetClasses,categoryInfoByPredictor,numTrees,"String_Node_Str",impurity,maxDepth,maxSplitCandidates,seed);
  }
 else {
    model=RandomForest.trainRegressor(trainPointData,categoryInfoByPredictor,numTrees,"String_Node_Str",impurity,maxDepth,maxSplitCandidates,seed);
  }
  List<Map<Integer,Long>> treeNodeIDCounts=treeNodeExampleCounts(trainPointData,model);
  Map<Integer,Long> predictorIndexCounts=predictorExampleCounts(trainPointData,model);
  return rdfModelToPMML(model,categoricalValueEncodings,maxDepth,maxSplitCandidates,impurity,treeNodeIDCounts,predictorIndexCounts);
}