Program: 31684
Project: 31684
Buggy source:
/** 
 * Create DerivedField for categorical variable
 * @param config - ColumnConfig for categorical variable
 * @param cutoff - cutoff for normalization
 * @param normType - the normalization method that is used to generate DerivedField
 * @return DerivedField for variable
 */
protected List<DerivedField> createCategoricalDerivedField(ColumnConfig config,double cutoff,ModelNormalizeConf.NormType normType){
  Document document=null;
  try {
    document=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  }
 catch (  ParserConfigurationException e) {
    LOG.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
  String defaultValue=Normalizer.normalize(config,"String_Node_Str",cutoff,normType).toString();
  String missingValue=Normalizer.normalize(config,null,cutoff,normType).toString();
  InlineTable inlineTable=new InlineTable();
  for (int i=0; i < config.getBinCategory().size(); i++) {
    List<String> catVals=CommonUtils.flattenCatValGrp(config.getBinCategory().get(i));
    for (    String cval : catVals) {
      String dval=Normalizer.normalize(config,cval,cutoff,normType).toString();
      Element out=document.createElementNS(NAME_SPACE_URI,ELEMENT_OUT);
      out.setTextContent(dval);
      Element origin=document.createElementNS(NAME_SPACE_URI,ELEMENT_ORIGIN);
      origin.setTextContent(cval);
      inlineTable.withRows(new Row().withContent(origin).withContent(out));
      String tmCval=CommonUtils.trimTag(cval);
      if (!cval.equals(tmCval)) {
        Element tmOut=document.createElementNS(NAME_SPACE_URI,ELEMENT_OUT);
        tmOut.setTextContent(dval);
        Element tmOrigin=document.createElementNS(NAME_SPACE_URI,ELEMENT_ORIGIN);
        tmOrigin.setTextContent(tmCval);
        inlineTable.withRows(new Row().withContent(origin).withContent(tmOut));
      }
    }
  }
  MapValues mapValues=new MapValues("String_Node_Str").withDataType(DataType.DOUBLE).withDefaultValue(defaultValue).withFieldColumnPairs(new FieldColumnPair(new FieldName(CommonUtils.getSimpleColumnName(config)),ELEMENT_ORIGIN)).withInlineTable(inlineTable).withMapMissingTo(missingValue);
  List<DerivedField> derivedFields=new ArrayList<DerivedField>();
  derivedFields.add(new DerivedField(OpType.CONTINUOUS,DataType.DOUBLE).withName(FieldName.create(genPmmlColumnName(CommonUtils.getSimpleColumnName(config),normType))).withExpression(mapValues));
  return derivedFields;
}

Fixed version (ground truth):
/** 
 * Create DerivedField for categorical variable
 * @param config - ColumnConfig for categorical variable
 * @param cutoff - cutoff for normalization
 * @param normType - the normalization method that is used to generate DerivedField
 * @return DerivedField for variable
 */
protected List<DerivedField> createCategoricalDerivedField(ColumnConfig config,double cutoff,ModelNormalizeConf.NormType normType){
  Document document=null;
  try {
    document=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  }
 catch (  ParserConfigurationException e) {
    LOG.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
  String defaultValue=Normalizer.normalize(config,"String_Node_Str",cutoff,normType).toString();
  String missingValue=Normalizer.normalize(config,null,cutoff,normType).toString();
  InlineTable inlineTable=new InlineTable();
  for (int i=0; i < config.getBinCategory().size(); i++) {
    List<String> catVals=CommonUtils.flattenCatValGrp(config.getBinCategory().get(i));
    for (    String cval : catVals) {
      String dval=Normalizer.normalize(config,cval,cutoff,normType).toString();
      Element out=document.createElementNS(NAME_SPACE_URI,ELEMENT_OUT);
      out.setTextContent(dval);
      Element origin=document.createElementNS(NAME_SPACE_URI,ELEMENT_ORIGIN);
      origin.setTextContent(cval);
      inlineTable.withRows(new Row().withContent(origin).withContent(out));
    }
  }
  MapValues mapValues=new MapValues("String_Node_Str").withDataType(DataType.DOUBLE).withDefaultValue(defaultValue).withFieldColumnPairs(new FieldColumnPair(new FieldName(CommonUtils.getSimpleColumnName(config)),ELEMENT_ORIGIN)).withInlineTable(inlineTable).withMapMissingTo(missingValue);
  List<DerivedField> derivedFields=new ArrayList<DerivedField>();
  derivedFields.add(new DerivedField(OpType.CONTINUOUS,DataType.DOUBLE).withName(FieldName.create(genPmmlColumnName(CommonUtils.getSimpleColumnName(config),normType))).withExpression(mapValues));
  return derivedFields;
}