Program: 76634
Project: 76634
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=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.getMessage(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 paramList=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.getMessage(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) {
      Object[] keyValue=new Object[params.size()];
      Set values=params.keySet();
      int i=0;
      for (Iterator it=values.iterator(); it.hasNext(); ) {
        keyValue[i]=params.get(it.next());
        i++;
      }
      paramList=doQueryCascadeParameterSelectionList(remainingParamNames.get(0).toString(),design,group.getName(),keyValue,options,attrBean);
      ret.put(remainingParamNames.get(0),paramList);
    }
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
  return ret;
}