Program: 77282
Project: 77282
Buggy source:
protected IViewerReportDesignHandle getDesignHandle(HttpServletRequest request){
  IViewerReportDesignHandle design=null;
  IReportRunnable reportRunnable=null;
  boolean isValidDocument=ParameterAccessor.isValidFilePath(this.reportDocumentName);
  if (isValidDocument) {
    IReportDocument reportDocumentInstance=ReportEngineService.getInstance().openReportDocument(this.reportDesignName,this.reportDocumentName,this.getModuleOptions(request));
    if (reportDocumentInstance != null) {
      reportRunnable=reportDocumentInstance.getReportRunnable();
      if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath())) {
        this.parameterMap=reportDocumentInstance.getParameterValues();
      }
      if (ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_REPORT_DOCUMENT) != null)       this.documentInUrl=true;
      reportDocumentInstance.close();
    }
  }
  if (reportRunnable == null) {
    if (ParameterAccessor.isReportParameterExist(request,ParameterAccessor.PARAM_REPORT_DOCUMENT) && !ParameterAccessor.isReportParameterExist(request,ParameterAccessor.PARAM_REPORT)) {
      if (isValidDocument)       this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_FILE_ERROR,new String[]{this.reportDocumentName});
 else       this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_ACCESS_ERROR,new String[]{this.reportDocumentName});
      return design;
    }
    if (!ParameterAccessor.isValidFilePath(this.reportDesignName)) {
      this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_REPORT_ACCESS_ERROR,new String[]{this.reportDesignName});
    }
 else {
      try {
        File file=new File(this.reportDesignName);
        if (file.exists()) {
          reportRunnable=ReportEngineService.getInstance().openReportDesign(this.reportDesignName,this.getModuleOptions(request));
        }
 else         if (!ParameterAccessor.isWorkingFolderAccessOnly()) {
          this.reportDesignName=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_REPORT);
          InputStream is=request.getSession().getServletContext().getResourceAsStream(this.reportDesignName);
          reportRunnable=ReportEngineService.getInstance().openReportDesign(is,this.getModuleOptions(request));
        }
 else {
          this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_REPORT_FILE_ERROR,new String[]{this.reportDesignName});
        }
      }
 catch (      EngineException e) {
        this.exception=e;
      }
    }
  }
  if (reportRunnable != null) {
    design=new BirtViewerReportDesignHandle(IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,reportRunnable);
  }
  return design;
}

Fixed version (ground truth):
protected IViewerReportDesignHandle getDesignHandle(HttpServletRequest request){
  IViewerReportDesignHandle design=null;
  IReportRunnable reportRunnable=null;
  boolean isValidDocument=ParameterAccessor.isValidFilePath(this.reportDocumentName);
  if (isValidDocument) {
    IReportDocument reportDocumentInstance=ReportEngineService.getInstance().openReportDocument(this.reportDesignName,this.reportDocumentName,this.getModuleOptions(request));
    if (reportDocumentInstance != null) {
      reportRunnable=reportDocumentInstance.getReportRunnable();
      if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath())) {
        this.parameterMap=reportDocumentInstance.getParameterValues();
      }
      if (ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_REPORT_DOCUMENT) != null)       this.documentInUrl=true;
      reportDocumentInstance.close();
    }
  }
  if (reportRunnable == null) {
    if (ParameterAccessor.isReportParameterExist(request,ParameterAccessor.PARAM_REPORT_DOCUMENT) && !ParameterAccessor.isReportParameterExist(request,ParameterAccessor.PARAM_REPORT)) {
      if (isValidDocument)       this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_FILE_ERROR,new String[]{this.reportDocumentName});
 else       this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_ACCESS_ERROR,new String[]{this.reportDocumentName});
      return design;
    }
    if (!ParameterAccessor.isValidFilePath(this.reportDesignName)) {
      this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_REPORT_ACCESS_ERROR,new String[]{this.reportDesignName});
    }
 else {
      try {
        File file=new File(this.reportDesignName);
        if (file.exists()) {
          reportRunnable=ReportEngineService.getInstance().openReportDesign(this.reportDesignName,this.getModuleOptions(request));
        }
 else         if (!ParameterAccessor.isWorkingFolderAccessOnly()) {
          this.reportDesignName=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_REPORT);
          InputStream is=null;
          URL url=null;
          try {
            String reportPath=this.reportDesignName;
            if (!reportPath.startsWith("String_Node_Str"))             reportPath="String_Node_Str" + reportPath;
            url=request.getSession().getServletContext().getResource(reportPath);
            is=url.openStream();
          }
 catch (          Exception e) {
          }
          reportRunnable=ReportEngineService.getInstance().openReportDesign(url.toString(),is,this.getModuleOptions(request));
        }
 else {
          this.exception=new ViewerException(ResourceConstants.GENERAL_EXCEPTION_REPORT_FILE_ERROR,new String[]{this.reportDesignName});
        }
      }
 catch (      EngineException e) {
        this.exception=e;
      }
    }
  }
  if (reportRunnable != null) {
    design=new BirtViewerReportDesignHandle(IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,reportRunnable);
  }
  return design;
}