Program: 86803
Project: 86803
Buggy source:
/** 
 * @see DataSetEvaluator#evaluate(DataSetDefinition,EvaluationContext)
 * @should evaluate a CohortIndicatorDataSetDefinition
 */
public MapDataSet evaluate(DataSetDefinition dataSetDefinition,EvaluationContext context){
  CohortIndicatorAndDimensionDataSetDefinition dsd=(CohortIndicatorAndDimensionDataSetDefinition)dataSetDefinition;
  MapDataSet ret=new MapDataSet(dataSetDefinition,context);
  context=ObjectUtil.nvl(context,new EvaluationContext());
  if (context.getBaseCohort() == null) {
    context.setBaseCohort(Context.getPatientSetService().getAllPatients());
  }
  IndicatorService is=Context.getService(IndicatorService.class);
  DimensionService ds=Context.getService(DimensionService.class);
  for (  CohortIndicatorAndDimensionSpecification spec : dsd.getSpecifications()) {
    List<String> combinations=IndicatorUtil.compileColumnDimensionOptions(spec.getDimensionOptions());
    combinations.add(0,null);
    for (    String combination : combinations) {
      CohortIndicatorResult result=(CohortIndicatorResult)is.evaluate(spec.getIndicator(),context);
      log.debug("String_Node_Str" + spec.getLabel() + "String_Node_Str"+ result.getValue());
      CohortIndicatorAndDimensionResult resultWithDimensions=new CohortIndicatorAndDimensionResult(result,context);
      DataSetColumn column=new DataSetColumn(spec.getIndicatorNumber(),spec.getLabel(),Object.class);
      if (combination != null) {
        for (        String option : combination.split("String_Node_Str")) {
          String[] dimOpt=option.split("String_Node_Str");
          column.setName(column.getName() + "String_Node_Str" + option);
          column.setLabel(column.getLabel() + (column.getLabel().equals(spec.getLabel()) ? "String_Node_Str" : "String_Node_Str") + dimOpt[0]+ "String_Node_Str"+ dimOpt[1]);
          Mapped<CohortDefinitionDimension> dimension=dsd.getDimension(dimOpt[0]);
          CohortDimensionResult dimensionResult=(CohortDimensionResult)ds.evaluate(dimension,context);
          Cohort dimensionCohort=dimensionResult.getCohort(dimOpt[1]);
          resultWithDimensions.addDimensionResult(dimension.getParameterizable(),dimensionCohort);
        }
        column.setLabel(column.getLabel() + "String_Node_Str");
      }
      ret.addData(column,resultWithDimensions);
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @throws EvaluationException 
 * @see DataSetEvaluator#evaluate(DataSetDefinition,EvaluationContext)
 * @should evaluate a CohortIndicatorDataSetDefinition
 */
public MapDataSet evaluate(DataSetDefinition dataSetDefinition,EvaluationContext context) throws EvaluationException {
  CohortIndicatorAndDimensionDataSetDefinition dsd=(CohortIndicatorAndDimensionDataSetDefinition)dataSetDefinition;
  MapDataSet ret=new MapDataSet(dataSetDefinition,context);
  context=ObjectUtil.nvl(context,new EvaluationContext());
  if (context.getBaseCohort() == null) {
    context.setBaseCohort(Context.getPatientSetService().getAllPatients());
  }
  IndicatorService is=Context.getService(IndicatorService.class);
  DimensionService ds=Context.getService(DimensionService.class);
  for (  CohortIndicatorAndDimensionSpecification spec : dsd.getSpecifications()) {
    List<String> combinations=IndicatorUtil.compileColumnDimensionOptions(spec.getDimensionOptions());
    combinations.add(0,null);
    for (    String combination : combinations) {
      CohortIndicatorResult result;
      try {
        result=(CohortIndicatorResult)is.evaluate(spec.getIndicator(),context);
      }
 catch (      EvaluationException ex) {
        throw new EvaluationException("String_Node_Str" + spec.getLabel() + "String_Node_Str"+ spec.getIndicatorNumber()+ "String_Node_Str");
      }
      log.debug("String_Node_Str" + spec.getLabel() + "String_Node_Str"+ result.getValue());
      CohortIndicatorAndDimensionResult resultWithDimensions=new CohortIndicatorAndDimensionResult(result,context);
      DataSetColumn column=new DataSetColumn(spec.getIndicatorNumber(),spec.getLabel(),Object.class);
      if (combination != null) {
        for (        String option : combination.split("String_Node_Str")) {
          String[] dimOpt=option.split("String_Node_Str");
          column.setName(column.getName() + "String_Node_Str" + option);
          column.setLabel(column.getLabel() + (column.getLabel().equals(spec.getLabel()) ? "String_Node_Str" : "String_Node_Str") + dimOpt[0]+ "String_Node_Str"+ dimOpt[1]);
          Mapped<CohortDefinitionDimension> dimension=dsd.getDimension(dimOpt[0]);
          try {
            CohortDimensionResult dimensionResult=(CohortDimensionResult)ds.evaluate(dimension,context);
            Cohort dimensionCohort=dimensionResult.getCohort(dimOpt[1]);
            resultWithDimensions.addDimensionResult(dimension.getParameterizable(),dimensionCohort);
          }
 catch (          EvaluationException ex) {
            throw new EvaluationException("String_Node_Str" + option);
          }
        }
        column.setLabel(column.getLabel() + "String_Node_Str");
      }
      ret.addData(column,resultWithDimensions);
    }
  }
  return ret;
}