Program: 31890
Project: 31890
Buggy source:
/** 
 * Create folder for sub-models, and create related files for sub-models. All settings in sub-model will use parent model as reference.
 * @return
 * @throws IOException
 */
private int initComboModels() throws IOException {
  if (this.comboModelTrain == null) {
    LOG.error("String_Node_Str");
    return 1;
  }
  String[] subModelNames=new String[this.comboModelTrain.getVarTrainConfList().size()];
  for (int i=0; i < this.comboModelTrain.getVarTrainConfList().size(); i++) {
    VarTrainConf varTrainConf=this.comboModelTrain.getVarTrainConfList().get(i);
    String subModelName=genSubModelName(i,varTrainConf);
    subModelNames[i]=subModelName;
    new File(subModelName).mkdirs();
    ModelConfig subModelConfig=this.modelConfig.clone();
    subModelConfig.getBasic().setName(subModelName);
    subModelConfig.setTrain(varTrainConf.getModelTrainConf());
    subModelConfig.getTrain().setCustomPaths(new HashMap<String,String>());
    String normalizedPath=pathFinder.getNormalizedDataPath();
    if (RawSourceData.SourceType.LOCAL.equals(modelConfig.getDataSet().getSource())) {
      normalizedPath=new File(normalizedPath).getAbsolutePath();
    }
    subModelConfig.getTrain().getCustomPaths().put(Constants.KEY_NORMALIZED_DATA_PATH,normalizedPath);
    List<ColumnConfig> columnConfigs=this.columnConfigList;
    if (CollectionUtils.isNotEmpty(varTrainConf.getVariables())) {
      Set<String> selectedVars=new HashSet<String>(varTrainConf.getVariables());
      columnConfigs=cloneColumnConfigs(this.columnConfigList);
      for (      ColumnConfig columnConfig : columnConfigs) {
        columnConfig.setFinalSelect(false);
        if (selectedVars.contains(columnConfig.getColumnName())) {
          columnConfig.setFinalSelect(true);
        }
      }
    }
    for (    EvalConfig evalConfig : subModelConfig.getEvals()) {
      String scoreMetaFileName=createModelNamesFile(subModelName,evalConfig.getName() + "String_Node_Str",evalConfig.getScoreMetaColumnNameFile(),this.genEvalScoreMetaVars(null));
      evalConfig.setScoreMetaColumnNameFile(scoreMetaFileName);
    }
    EvalConfig trainEval=new EvalConfig();
    trainEval.setName(genEvalTrainName());
    trainEval.setDataSet(subModelConfig.getDataSet().cloneRawSourceData());
    String scoreMetaFileName=createModelNamesFile(subModelName,trainEval.getName() + "String_Node_Str",null,this.genEvalScoreMetaVars(this.modelConfig.getDataSet().getWeightColumnName()));
    trainEval.setScoreMetaColumnNameFile(scoreMetaFileName);
    subModelConfig.getEvals().add(trainEval);
    saveModelConfig(subModelName,subModelConfig);
    saveColumnConfigList(subModelName,columnConfigs);
  }
  ModelConfig assembleModelConfig=this.modelConfig.clone();
  String assembleModelName=genAssembleModelName(this.modelConfig.getModelSetName());
  new File(assembleModelName).mkdirs();
  assembleModelConfig.setModelSetName(assembleModelName);
  assembleModelConfig.getDataSet().setCategoricalColumnNameFile(null);
  assembleModelConfig.getVarSelect().setForceRemoveColumnNameFile(null);
  String forceSelectNames=createModelNamesFile(assembleModelName,assembleModelName + "String_Node_Str",null,CommonUtils.genPigFieldName(subModelNames));
  assembleModelConfig.getVarSelect().setForceSelectColumnNameFile(forceSelectNames);
  assembleModelConfig.getVarSelect().setForceEnable(true);
  assembleModelConfig.getVarSelect().setFilterNum(subModelNames.length);
  assembleModelConfig.getVarSelect().setFilterEnable(true);
  String metaColumnNames=createModelNamesFile(assembleModelName,assembleModelName + "String_Node_Str",null,this.comboModelTrain.getUidColumnName());
  assembleModelConfig.getDataSet().setMetaColumnNameFile(metaColumnNames);
  assembleModelConfig.setTrain(this.comboModelTrain.getFusionModelTrainConf());
  for (  EvalConfig evalConfig : assembleModelConfig.getEvals()) {
    String scoreMetaFileName=createModelNamesFile(assembleModelName,evalConfig.getName() + "String_Node_Str",evalConfig.getScoreMetaColumnNameFile(),this.genEvalScoreMetaVars(null));
    evalConfig.setScoreMetaColumnNameFile(scoreMetaFileName);
  }
  new File(assembleModelName).mkdirs();
  saveModelConfig(assembleModelName,assembleModelConfig);
  return 0;
}

Fixed version (ground truth):
/** 
 * Create folder for sub-models, and create related files for sub-models. All settings in sub-model will use parent model as reference.
 * @return 0 successful, otherwise failed
 * @throws IOException any io exception
 */
private int initComboModels() throws IOException {
  if (this.comboModelTrain == null) {
    LOG.error("String_Node_Str");
    return 1;
  }
  String[] subModelNames=new String[this.comboModelTrain.getVarTrainConfList().size()];
  for (int i=0; i < this.comboModelTrain.getVarTrainConfList().size(); i++) {
    VarTrainConf varTrainConf=this.comboModelTrain.getVarTrainConfList().get(i);
    String subModelName=genSubModelName(i,varTrainConf);
    subModelNames[i]=subModelName;
    new File(subModelName).mkdirs();
    ModelConfig subModelConfig=this.modelConfig.clone();
    subModelConfig.getBasic().setName(subModelName);
    subModelConfig.setTrain(varTrainConf.getModelTrainConf());
    subModelConfig.getTrain().setCustomPaths(new HashMap<String,String>());
    String normalizedPath=pathFinder.getNormalizedDataPath();
    if (RawSourceData.SourceType.LOCAL.equals(modelConfig.getDataSet().getSource())) {
      normalizedPath=new File(normalizedPath).getAbsolutePath();
    }
    subModelConfig.getTrain().getCustomPaths().put(Constants.KEY_NORMALIZED_DATA_PATH,normalizedPath);
    List<ColumnConfig> columnConfigs=this.columnConfigList;
    if (CollectionUtils.isNotEmpty(varTrainConf.getVariables())) {
      Set<String> selectedVars=new HashSet<String>(varTrainConf.getVariables());
      columnConfigs=cloneColumnConfigs(this.columnConfigList);
      for (      ColumnConfig columnConfig : columnConfigs) {
        columnConfig.setFinalSelect(false);
        if (selectedVars.contains(columnConfig.getColumnName())) {
          columnConfig.setFinalSelect(true);
        }
      }
    }
    for (    EvalConfig evalConfig : subModelConfig.getEvals()) {
      String scoreMetaFileName=createModelNamesFile(subModelName,evalConfig.getName() + "String_Node_Str",evalConfig.getScoreMetaColumnNameFile(),this.genEvalScoreMetaVars(null));
      evalConfig.setScoreMetaColumnNameFile(scoreMetaFileName);
    }
    EvalConfig trainEval=new EvalConfig();
    trainEval.setName(genEvalTrainName());
    trainEval.setDataSet(subModelConfig.getDataSet().cloneRawSourceData());
    String scoreMetaFileName=createModelNamesFile(subModelName,trainEval.getName() + "String_Node_Str",null,this.genEvalScoreMetaVars(this.modelConfig.getDataSet().getWeightColumnName()));
    trainEval.setScoreMetaColumnNameFile(scoreMetaFileName);
    subModelConfig.getEvals().add(trainEval);
    saveModelConfig(subModelName,subModelConfig);
    saveColumnConfigList(subModelName,columnConfigs);
  }
  ModelConfig assembleModelConfig=this.modelConfig.clone();
  String assembleModelName=genAssembleModelName(this.modelConfig.getModelSetName());
  new File(assembleModelName).mkdirs();
  assembleModelConfig.setModelSetName(assembleModelName);
  assembleModelConfig.getDataSet().setCategoricalColumnNameFile(null);
  assembleModelConfig.getVarSelect().setForceRemoveColumnNameFile(null);
  String forceSelectNames=createModelNamesFile(assembleModelName,assembleModelName + "String_Node_Str",null,CommonUtils.genPigFieldName(subModelNames));
  assembleModelConfig.getVarSelect().setForceSelectColumnNameFile(forceSelectNames);
  assembleModelConfig.getVarSelect().setForceEnable(true);
  assembleModelConfig.getVarSelect().setFilterNum(subModelNames.length);
  assembleModelConfig.getVarSelect().setFilterEnable(true);
  String metaColumnNames=createModelNamesFile(assembleModelName,assembleModelName + "String_Node_Str",null,this.comboModelTrain.getUidColumnName());
  assembleModelConfig.getDataSet().setMetaColumnNameFile(metaColumnNames);
  assembleModelConfig.setTrain(this.comboModelTrain.getFusionModelTrainConf());
  for (  EvalConfig evalConfig : assembleModelConfig.getEvals()) {
    String scoreMetaFileName=createModelNamesFile(assembleModelName,evalConfig.getName() + "String_Node_Str",evalConfig.getScoreMetaColumnNameFile(),this.genEvalScoreMetaVars(null));
    evalConfig.setScoreMetaColumnNameFile(scoreMetaFileName);
  }
  new File(assembleModelName).mkdirs();
  saveModelConfig(assembleModelName,assembleModelConfig);
  return 0;
}