Program: 72795
Project: 72795
Buggy source:
private Collection doGetSelectionList(String name){
  usingParameterValues();
  ReportDesignHandle report=executionContext.getDesign();
  ScalarParameterHandle parameter=(ScalarParameterHandle)report.findParameter(name);
  if (parameter == null) {
    return Collections.EMPTY_LIST;
  }
  String selectionType=parameter.getValueType();
  String dataType=parameter.getDataType();
  boolean fixedOrder=parameter.isFixedOrder();
  boolean sortByLabel="String_Node_Str".equalsIgnoreCase(parameter.getSortBy());
  boolean sortDirectionValue="String_Node_Str".equalsIgnoreCase(parameter.getSortDirection());
  if (DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC.equals(selectionType)) {
    CascadingParameterGroupHandle group=null;
    if (isCascadingParameter(parameter)) {
      group=getCascadingGroup(parameter);
    }
    if (group != null) {
      if (DesignChoiceConstants.DATA_SET_MODE_SINGLE.equals(group.getDataSetMode())) {
        return getCascadingParameterList(parameter);
      }
 else {
        if (parameter.getDataSetName() != null) {
          return getChoicesFromParameterQuery(parameter);
        }
      }
    }
 else {
      if (parameter.getDataSetName() != null) {
        return getChoicesFromParameterQuery(parameter);
      }
    }
  }
 else   if (DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC.equals(selectionType)) {
    Iterator iter=parameter.choiceIterator();
    ArrayList choices=new ArrayList();
    while (iter.hasNext()) {
      SelectionChoiceHandle choice=(SelectionChoiceHandle)iter.next();
      String label=report.getMessage(choice.getLabelKey(),locale);
      if (label == null) {
        label=choice.getLabel();
      }
      Object value=convertToType(choice.getValue(),dataType);
      choices.add(new SelectionChoice(label,value));
    }
    if (!fixedOrder)     Collections.sort(choices,new SelectionChoiceComparator(sortByLabel,parameter.getPattern(),sortDirectionValue,ULocale.forLocale(locale)));
    return choices;
  }
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
private Collection doGetSelectionList(String name){
  usingParameterValues();
  ReportDesignHandle report=executionContext.getDesign();
  ScalarParameterHandle parameter=(ScalarParameterHandle)report.findParameter(name);
  if (parameter == null) {
    executionContext.addException(new EngineException(MessageConstants.PARAMETER_ISNOT_FOUND_BY_NAME_EXCEPTION,name));
    return Collections.EMPTY_LIST;
  }
  String selectionType=parameter.getValueType();
  String dataType=parameter.getDataType();
  boolean fixedOrder=parameter.isFixedOrder();
  boolean sortByLabel="String_Node_Str".equalsIgnoreCase(parameter.getSortBy());
  boolean sortDirectionValue="String_Node_Str".equalsIgnoreCase(parameter.getSortDirection());
  if (DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC.equals(selectionType)) {
    CascadingParameterGroupHandle group=null;
    if (isCascadingParameter(parameter)) {
      group=getCascadingGroup(parameter);
    }
    if (group != null) {
      if (DesignChoiceConstants.DATA_SET_MODE_SINGLE.equals(group.getDataSetMode())) {
        return getCascadingParameterList(parameter);
      }
 else {
        if (parameter.getDataSetName() != null) {
          return getChoicesFromParameterQuery(parameter);
        }
      }
    }
 else {
      if (parameter.getDataSetName() != null) {
        return getChoicesFromParameterQuery(parameter);
      }
    }
  }
 else   if (DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC.equals(selectionType)) {
    Iterator iter=parameter.choiceIterator();
    ArrayList choices=new ArrayList();
    while (iter.hasNext()) {
      SelectionChoiceHandle choice=(SelectionChoiceHandle)iter.next();
      String label=report.getMessage(choice.getLabelKey(),locale);
      if (label == null) {
        label=choice.getLabel();
      }
      Object value=convertToType(choice.getValue(),dataType);
      choices.add(new SelectionChoice(label,value));
    }
    if (!fixedOrder)     Collections.sort(choices,new SelectionChoiceComparator(sortByLabel,parameter.getPattern(),sortDirectionValue,ULocale.forLocale(locale)));
    return choices;
  }
  return Collections.EMPTY_LIST;
}