Program: 78174
Project: 78174
Buggy source:
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
  String reportDesignName=ParameterAccessor.getReport(request);
  ViewerAttributeBean attrBean=(ViewerAttributeBean)request.getAttribute("String_Node_Str");
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,reportDesignName);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  Collection selectionList=null;
  ParameterDefinition paramDef=parameterBean.getParameter();
  if (paramDef.getGroup() != null) {
    Map paramValues=attrBean.getParameters();
    selectionList=getParameterSelectionListForCascadingGroup(design,service,paramValues);
  }
 else   selectionList=service.getParameterSelectionList(design,options,parameter.getName());
  parameterBean.setValueInList(false);
  if (selectionList != null) {
    ReportParameterConverter converter=new ReportParameterConverter(parameter.getPattern(),locale);
    for (Iterator iter=selectionList.iterator(); iter.hasNext(); ) {
      ParameterSelectionChoice selectionItem=(ParameterSelectionChoice)iter.next();
      String value=converter.format(selectionItem.getValue());
      String label=selectionItem.getLabel();
      label=(label == null || label.length() <= 0) ? value : label;
      label=ParameterAccessor.htmlEncode(label);
      if (label != null) {
        parameterBean.getSelectionList().add(label);
        parameterBean.getSelectionTable().put(label,value);
      }
      if (value != null && value.equals(parameterBean.getValue())) {
        parameterBean.setValueInList(true);
      }
    }
  }
}

Fixed version (ground truth):
protected void prepareParameterBean(HttpServletRequest request,IViewerReportService service,ScalarParameterBean parameterBean,Locale locale) throws ReportServiceException {
  String reportDesignName=ParameterAccessor.getReport(request);
  ViewerAttributeBean attrBean=(ViewerAttributeBean)request.getAttribute("String_Node_Str");
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,reportDesignName);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  Collection selectionList=null;
  ParameterDefinition paramDef=parameterBean.getParameter();
  if (paramDef.getGroup() != null && paramDef.getGroup().cascade()) {
    Map paramValues=attrBean.getParameters();
    selectionList=getParameterSelectionListForCascadingGroup(design,service,paramValues);
  }
 else   selectionList=service.getParameterSelectionList(design,options,parameter.getName());
  parameterBean.setValueInList(false);
  if (selectionList != null) {
    ReportParameterConverter converter=new ReportParameterConverter(parameter.getPattern(),locale);
    for (Iterator iter=selectionList.iterator(); iter.hasNext(); ) {
      ParameterSelectionChoice selectionItem=(ParameterSelectionChoice)iter.next();
      String value=converter.format(selectionItem.getValue());
      String label=selectionItem.getLabel();
      label=(label == null || label.length() <= 0) ? value : label;
      label=ParameterAccessor.htmlEncode(label);
      if (label != null) {
        parameterBean.getSelectionList().add(label);
        parameterBean.getSelectionTable().put(label,value);
      }
      if (value != null && value.equals(parameterBean.getValue())) {
        parameterBean.setValueInList(true);
      }
    }
  }
}