Program: 86772
Project: 86772
Buggy source:
/** 
 * @throws org.openmrs.module.reporting.evaluation.EvaluationException
 * @see org.openmrs.module.reporting.dataset.definition.evaluator.DataSetEvaluator#evaluate(org.openmrs.module.reporting.dataset.definition.DataSetDefinition,org.openmrs.module.reporting.evaluation.EvaluationContext)
 * @should evaluate a MultiParameterDataSetDefinition
 */
public DataSet evaluate(DataSetDefinition dataSetDefinition,EvaluationContext context) throws EvaluationException {
  if (context == null) {
    context=new EvaluationContext();
  }
  MultiParameterDataSetDefinition dsd=(MultiParameterDataSetDefinition)dataSetDefinition;
  SimpleDataSet ret=new SimpleDataSet(dsd,context);
  for (  Map<String,Object> iteration : dsd.getIterations()) {
    EvaluationContext ec=context.shallowCopy();
    SimpleDataSet ds;
    try {
      Mapped<DataSetDefinition> mapped=new Mapped<DataSetDefinition>();
      mapped.setParameterizable(dsd.getBaseDefinition());
      for (      Map.Entry<String,Object> param : iteration.entrySet()) {
        mapped.addParameterMapping(param.getKey(),param.getValue());
      }
      ds=(SimpleDataSet)Context.getService(DataSetDefinitionService.class).evaluate(mapped,ec);
    }
 catch (    Exception ex) {
      throw new EvaluationException("String_Node_Str",ex);
    }
    DataSetRowList rows=ds.getRows();
    for (    DataSetRow dsRow : rows) {
      DataSetRow row=new DataSetRow();
      for (      Map.Entry<String,Object> param : ds.getContext().getParameterValues().entrySet()) {
        String columnName="String_Node_Str" + param.getKey();
        row.addColumnValue(new DataSetColumn(columnName,columnName,String.class),param.getValue());
      }
      for (      Map.Entry<DataSetColumn,Object> entry : dsRow.getColumnValues().entrySet()) {
        row.addColumnValue(entry.getKey(),entry.getValue());
      }
      ret.addRow(row);
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @throws org.openmrs.module.reporting.evaluation.EvaluationException
 * @see org.openmrs.module.reporting.dataset.definition.evaluator.DataSetEvaluator#evaluate(org.openmrs.module.reporting.dataset.definition.DataSetDefinition,org.openmrs.module.reporting.evaluation.EvaluationContext)
 * @should evaluate a MultiParameterDataSetDefinition
 */
public DataSet evaluate(DataSetDefinition dataSetDefinition,EvaluationContext context) throws EvaluationException {
  if (context == null) {
    context=new EvaluationContext();
  }
  MultiParameterDataSetDefinition dsd=(MultiParameterDataSetDefinition)dataSetDefinition;
  SimpleDataSet ret=new SimpleDataSet(dsd,context);
  for (  Map<String,Object> iteration : dsd.getIterations()) {
    EvaluationContext ec=context.shallowCopy();
    DataSet ds;
    try {
      Mapped<DataSetDefinition> mapped=new Mapped<DataSetDefinition>();
      mapped.setParameterizable(dsd.getBaseDefinition());
      for (      Map.Entry<String,Object> param : iteration.entrySet()) {
        mapped.addParameterMapping(param.getKey(),param.getValue());
      }
      ds=dataSetDefinitionService.evaluate(mapped,ec);
    }
 catch (    Exception ex) {
      throw new EvaluationException("String_Node_Str",ex);
    }
    Iterator<DataSetRow> iterator=ds.iterator();
    while (iterator.hasNext()) {
      DataSetRow row=new DataSetRow();
      for (      Map.Entry<String,Object> param : ds.getContext().getParameterValues().entrySet()) {
        String columnName="String_Node_Str" + param.getKey();
        row.addColumnValue(new DataSetColumn(columnName,columnName,String.class),param.getValue());
      }
      for (      Map.Entry<DataSetColumn,Object> entry : iterator.next().getColumnValues().entrySet()) {
        row.addColumnValue(entry.getKey(),entry.getValue());
      }
      ret.addRow(row);
    }
  }
  return ret;
}