Program: 76019
Project: 76019
Buggy source:
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  List selectionList=new ArrayList();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
    Iterator iList=list.iterator();
    int index=0;
    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;
}

Fixed version (ground truth):
/** 
 * Returns the cascading parameter selection list
 * @param paramName
 * @param design
 * @param groupName
 * @param groupKeys
 * @param options
 * @param attrBean
 * @return
 * @throws RemoteException
 * @throws ReportServiceException
 */
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
  List selectionList=preHandleCascadeParameterSelectionList(parameter,attrBean);
  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;
}