Program: 31741
Project: 31741
Buggy source:
private void writeModelToFileSystem(List<TreeNode> trees,Path out){
  DataOutputStream fos=null;
  try {
    fos=new DataOutputStream(new GZIPOutputStream(FileSystem.get(new Configuration()).create(out)));
    LOG.info("String_Node_Str",trees.size(),out);
    fos.writeInt(CommonConstants.TREE_FORMAT_VERSION);
    fos.writeUTF(modelConfig.getAlgorithm());
    fos.writeUTF(this.validParams.get("String_Node_Str").toString());
    fos.writeBoolean(this.modelConfig.isClassification());
    fos.writeBoolean(this.modelConfig.getTrain().isOneVsAll());
    fos.writeInt(this.inputCount);
    Map<Integer,String> columnIndexNameMapping=new HashMap<Integer,String>();
    Map<Integer,List<String>> columnIndexCategoricalListMapping=new HashMap<Integer,List<String>>();
    Map<Integer,Double> numericalMeanMapping=new HashMap<Integer,Double>();
    for (    ColumnConfig columnConfig : this.columnConfigList) {
      if (columnConfig.isFinalSelect()) {
        columnIndexNameMapping.put(columnConfig.getColumnNum(),columnConfig.getColumnName());
      }
      if (columnConfig.isCategorical() && CollectionUtils.isNotEmpty(columnConfig.getBinCategory())) {
        List<String> binCatVals=new ArrayList<String>();
        for (        String catGrp : columnConfig.getBinCategory()) {
          binCatVals.addAll(CommonUtils.flattenCatValGrp(catGrp));
        }
        columnIndexCategoricalListMapping.put(columnConfig.getColumnNum(),binCatVals);
      }
      if (columnConfig.isNumerical() && columnConfig.getMean() != null) {
        numericalMeanMapping.put(columnConfig.getColumnNum(),columnConfig.getMean());
      }
    }
    if (columnIndexNameMapping.size() == 0) {
      for (      ColumnConfig columnConfig : this.columnConfigList) {
        if (CommonUtils.isGoodCandidate(columnConfig)) {
          columnIndexNameMapping.put(columnConfig.getColumnNum(),columnConfig.getColumnName());
        }
      }
    }
    fos.writeInt(numericalMeanMapping.size());
    for (    Entry<Integer,Double> entry : numericalMeanMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeDouble(entry.getValue() == null ? 0d : entry.getValue());
    }
    fos.writeInt(columnIndexNameMapping.size());
    for (    Entry<Integer,String> entry : columnIndexNameMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeUTF(entry.getValue());
    }
    fos.writeInt(columnIndexCategoricalListMapping.size());
    for (    Entry<Integer,List<String>> entry : columnIndexCategoricalListMapping.entrySet()) {
      List<String> categories=entry.getValue();
      if (categories != null) {
        fos.writeInt(entry.getKey());
        fos.writeInt(categories.size());
        for (        String category : categories) {
          fos.writeUTF(category);
        }
      }
    }
    Map<Integer,Integer> columnMapping=getColumnMapping();
    fos.writeInt(columnMapping.size());
    for (    Entry<Integer,Integer> entry : columnMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeInt(entry.getValue());
    }
    int treeLength=trees.size();
    fos.writeInt(treeLength);
    for (    TreeNode treeNode : trees) {
      treeNode.write(fos);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeStream(fos);
  }
}

Fixed version (ground truth):
private void writeModelToFileSystem(List<TreeNode> trees,Path out){
  DataOutputStream fos=null;
  try {
    fos=new DataOutputStream(new GZIPOutputStream(FileSystem.get(new Configuration()).create(out)));
    LOG.info("String_Node_Str",trees.size(),out);
    fos.writeInt(CommonConstants.TREE_FORMAT_VERSION);
    fos.writeUTF(modelConfig.getAlgorithm());
    fos.writeUTF(this.validParams.get("String_Node_Str").toString());
    fos.writeBoolean(this.modelConfig.isClassification());
    fos.writeBoolean(this.modelConfig.getTrain().isOneVsAll());
    fos.writeInt(this.inputCount);
    Map<Integer,String> columnIndexNameMapping=new HashMap<Integer,String>();
    Map<Integer,List<String>> columnIndexCategoricalListMapping=new HashMap<Integer,List<String>>();
    Map<Integer,Double> numericalMeanMapping=new HashMap<Integer,Double>();
    for (    ColumnConfig columnConfig : this.columnConfigList) {
      if (columnConfig.isFinalSelect()) {
        columnIndexNameMapping.put(columnConfig.getColumnNum(),columnConfig.getColumnName());
      }
      if (columnConfig.isCategorical() && CollectionUtils.isNotEmpty(columnConfig.getBinCategory())) {
        columnIndexCategoricalListMapping.put(columnConfig.getColumnNum(),columnConfig.getBinCategory());
      }
      if (columnConfig.isNumerical() && columnConfig.getMean() != null) {
        numericalMeanMapping.put(columnConfig.getColumnNum(),columnConfig.getMean());
      }
    }
    if (columnIndexNameMapping.size() == 0) {
      for (      ColumnConfig columnConfig : this.columnConfigList) {
        if (CommonUtils.isGoodCandidate(columnConfig)) {
          columnIndexNameMapping.put(columnConfig.getColumnNum(),columnConfig.getColumnName());
        }
      }
    }
    fos.writeInt(numericalMeanMapping.size());
    for (    Entry<Integer,Double> entry : numericalMeanMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeDouble(entry.getValue() == null ? 0d : entry.getValue());
    }
    fos.writeInt(columnIndexNameMapping.size());
    for (    Entry<Integer,String> entry : columnIndexNameMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeUTF(entry.getValue());
    }
    fos.writeInt(columnIndexCategoricalListMapping.size());
    for (    Entry<Integer,List<String>> entry : columnIndexCategoricalListMapping.entrySet()) {
      List<String> categories=entry.getValue();
      if (categories != null) {
        fos.writeInt(entry.getKey());
        fos.writeInt(categories.size());
        for (        String category : categories) {
          fos.writeUTF(category);
        }
      }
    }
    Map<Integer,Integer> columnMapping=getColumnMapping();
    fos.writeInt(columnMapping.size());
    for (    Entry<Integer,Integer> entry : columnMapping.entrySet()) {
      fos.writeInt(entry.getKey());
      fos.writeInt(entry.getValue());
    }
    int treeLength=trees.size();
    fos.writeInt(treeLength);
    for (    TreeNode treeNode : trees) {
      treeNode.write(fos);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeStream(fos);
  }
}