Program: 74412
Project: 74412
Buggy source:
/** 
 * Returns the cascading parameter selection list
 * @param paramName
 * @param design
 * @param groupName
 * @param groupKeys
 * @param options
 * @param attrBean
 * @param keepDefValue
 * @return
 * @throws RemoteException
 * @throws ReportServiceException
 */
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean,boolean keepDefValue) throws RemoteException, ReportServiceException {
  ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
  String defaultValue=null;
  String defaultLabel=null;
  if (keepDefValue) {
    Object obj=attrBean.getDefaultValues().get(parameter.getName());
    if (obj != null) {
      defaultValue=DataUtil.getDisplayValue(obj);
      defaultLabel=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),obj,attrBean.getLocale());
    }
  }
  List selectionList=preHandleCascadeParameterSelectionList(parameter,defaultValue,defaultLabel);
  int index=selectionList.size();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    Iterator iList=list.iterator();
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item == null)       continue;
      Object value=item.getValue();
      try {
        value=DataUtil.convert(value,parameter.getDataType());
      }
 catch (      Exception e) {
        value=null;
      }
      String displayValue=DataUtil.getDisplayValue(value);
      if (displayValue == null)       continue;
      String label=item.getLabel();
      if (label == null || label.length() <= 0) {
        label=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),value,attrBean.getLocale());
      }
      if (label != null) {
        if (keepDefValue) {
          if (displayValue.equals(defaultValue) && (label.equals(defaultLabel) || parameter.isDistinct()))           continue;
        }
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(displayValue);
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}

Fixed version (ground truth):
/** 
 * Returns the cascading parameter selection list
 * @param paramName
 * @param design
 * @param groupName
 * @param groupKeys
 * @param options
 * @param attrBean
 * @param keepDefValue
 * @return
 * @throws RemoteException
 * @throws ReportServiceException
 */
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean,boolean keepDefValue) throws RemoteException, ReportServiceException {
  ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
  String defaultValue=null;
  String defaultLabel=null;
  if (keepDefValue) {
    Object obj=attrBean.getDefaultValues().get(parameter.getName());
    if (obj != null) {
      defaultValue=DataUtil.getDisplayValue(obj);
      defaultLabel=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),obj,attrBean.getLocale());
    }
  }
  List selectionList=preHandleCascadeParameterSelectionList(parameter,defaultValue,defaultLabel);
  int index=selectionList.size();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    Iterator iList=list.iterator();
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item == null)       continue;
      Object value=item.getValue();
      try {
        value=DataUtil.convert(value,parameter.getDataType());
      }
 catch (      Exception e) {
        value=null;
      }
      String displayValue=DataUtil.getDisplayValue(value);
      if (displayValue == null)       continue;
      String label=item.getLabel();
      if (label == null || label.length() <= 0) {
        label=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),value,attrBean.getLocale());
      }
      if (label != null) {
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(displayValue);
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}