Program: 77683
Project: 77683
Buggy source:
private Map getParameterSelectionLists(IViewerReportDesignHandle design,Map params,InputOptions options,ViewerAttributeBean attrBean) throws ReportServiceException {
  if (params == null || params.size() == 0)   return new HashMap();
  List[] listArray=null;
  Map ret=new HashMap();
  List remainingParamNames=new ArrayList();
  String firstName=(String)params.keySet().iterator().next();
  Collection paramDefs=getReportService().getParameterDefinitions(design,options,false);
  ParameterDefinition paramDef=null;
  for (Iterator it=paramDefs.iterator(); it.hasNext(); ) {
    ParameterDefinition temp=(ParameterDefinition)it.next();
    if (temp.getName().equals(firstName)) {
      paramDef=temp;
      break;
    }
  }
  if (paramDef == null) {
    throw new ReportServiceException(BirtResources.getFormattedString(ResourceConstants.REPORT_SERVICE_EXCEPTION_INVALID_PARAMETER,new String[]{firstName}));
  }
  ParameterGroupDefinition group=paramDef.getGroup();
  if (group != null) {
    if (group.getParameterCount() > params.size()) {
      int remainingParams=group.getParameterCount() - params.size();
      for (int i=0; i < remainingParams; i++) {
        ParameterDefinition def=(ParameterDefinition)group.getParameters().get(params.size() + i);
        remainingParamNames.add(def.getName());
      }
    }
  }
  try {
    if (remainingParamNames.size() > 0) {
      listArray=new List[remainingParamNames.size()];
      for (int k=0; k < remainingParamNames.size(); k++) {
        Object[] keyValue=new Object[params.size() + k];
        Set values=params.keySet();
        int i=0;
        for (Iterator it=values.iterator(); it.hasNext(); ) {
          keyValue[i]=params.get(it.next());
          i++;
        }
        for (i=0; i < k; i++) {
          if (listArray[i].isEmpty()) {
            keyValue[params.size() + i]=null;
          }
 else {
            keyValue[params.size() + i]=listArray[i].get(0);
          }
        }
        listArray[k]=doQueryCascadeParameterSelectionList(remainingParamNames.get(k).toString(),design,group.getName(),keyValue,options,attrBean);
        ret.put(remainingParamNames.get(k),listArray[k]);
      }
    }
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
  return ret;
}

Fixed version (ground truth):
private Map getParameterSelectionLists(IViewerReportDesignHandle design,Map params,InputOptions options,ViewerAttributeBean attrBean) throws ReportServiceException {
  if (params == null || params.size() == 0)   return new HashMap();
  List[] listArray=null;
  Map ret=new HashMap();
  List remainingParamNames=new ArrayList();
  String firstName=(String)params.keySet().iterator().next();
  Collection paramDefs=attrBean.getParameterDefList();
  ParameterDefinition paramDef=null;
  for (Iterator it=paramDefs.iterator(); it.hasNext(); ) {
    ParameterDefinition temp=(ParameterDefinition)it.next();
    if (temp.getName().equals(firstName)) {
      paramDef=temp;
      break;
    }
  }
  if (paramDef == null) {
    throw new ReportServiceException(BirtResources.getFormattedString(ResourceConstants.REPORT_SERVICE_EXCEPTION_INVALID_PARAMETER,new String[]{firstName}));
  }
  ParameterGroupDefinition group=paramDef.getGroup();
  if (group != null) {
    if (group.getParameterCount() > params.size()) {
      int remainingParams=group.getParameterCount() - params.size();
      for (int i=0; i < remainingParams; i++) {
        ParameterDefinition def=(ParameterDefinition)group.getParameters().get(params.size() + i);
        remainingParamNames.add(def.getName());
      }
    }
  }
  try {
    if (remainingParamNames.size() > 0) {
      listArray=new List[remainingParamNames.size()];
      for (int k=0; k < remainingParamNames.size(); k++) {
        Object[] keyValue=new Object[params.size() + k];
        Set values=params.keySet();
        int i=0;
        for (Iterator it=values.iterator(); it.hasNext(); ) {
          keyValue[i]=params.get(it.next());
          i++;
        }
        for (i=0; i < k; i++) {
          if (listArray[i].isEmpty()) {
            keyValue[params.size() + i]=null;
          }
 else {
            keyValue[params.size() + i]=listArray[i].get(0);
          }
        }
        listArray[k]=doQueryCascadeParameterSelectionList(remainingParamNames.get(k).toString(),design,group.getName(),keyValue,options,attrBean);
        ret.put(remainingParamNames.get(k),listArray[k]);
      }
    }
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
  return ret;
}