Program: 74358
Project: 74358
Buggy source:
/** 
 * Render context from document file
 * @param out
 * @throws Exception
 */
private void __renderDocument(OutputStream out) throws Exception {
  HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
  String documentFile=ParameterAccessor.getReportDocument(request,viewer.getReportDocument(),false);
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(null,documentFile,BirtTagUtil.getModuleOptions(viewer));
  try {
    Locale locale=(Locale)this.options.getOption(InputOptions.OPT_LOCALE);
    String format=(String)this.options.getOption(InputOptions.OPT_FORMAT);
    Boolean isMasterPageContent=(Boolean)this.options.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
    boolean isMasterPage=isMasterPageContent == null ? false : isMasterPageContent.booleanValue();
    Boolean svgFlag=(Boolean)this.options.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
    boolean isSvg=svgFlag == null ? false : svgFlag.booleanValue();
    Boolean isRtl=(Boolean)this.options.getOption(InputOptions.OPT_RTL);
    String servletPath=(String)this.options.getOption(InputOptions.OPT_SERVLET_PATH);
    if (viewer.getReportletId() != null) {
      ReportEngineService.getInstance().renderReportlet(out,request,doc,viewer.getReportletId(),format,isMasterPage,isSvg,null,locale,isRtl.booleanValue(),servletPath);
    }
 else {
      ReportEngineService.getInstance().renderReport(out,request,doc,format,viewer.getPageNum(),viewer.getPageRange(),isMasterPage,isSvg,null,locale,isRtl.booleanValue(),servletPath);
    }
  }
  finally {
    if (doc != null)     doc.close();
  }
}

Fixed version (ground truth):
/** 
 * Render context from document file
 * @param out
 * @throws Exception
 */
private void __renderDocument(OutputStream out) throws Exception {
  HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
  String documentFile=ParameterAccessor.getReportDocument(request,viewer.getReportDocument(),false);
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(null,documentFile,BirtTagUtil.getModuleOptions(viewer));
  try {
    Locale locale=(Locale)this.options.getOption(InputOptions.OPT_LOCALE);
    String format=(String)this.options.getOption(InputOptions.OPT_FORMAT);
    Boolean isMasterPageContent=(Boolean)this.options.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
    boolean isMasterPage=isMasterPageContent == null ? false : isMasterPageContent.booleanValue();
    Boolean svgFlag=(Boolean)this.options.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
    boolean isSvg=svgFlag == null ? false : svgFlag.booleanValue();
    Boolean isRtl=(Boolean)this.options.getOption(InputOptions.OPT_RTL);
    String servletPath=(String)this.options.getOption(InputOptions.OPT_SERVLET_PATH);
    String realReportletId=viewer.getReportletId();
    if (realReportletId == null) {
      if (viewer.getBookmark() != null && "String_Node_Str".equalsIgnoreCase(viewer.getIsReportlet())) {
        realReportletId=viewer.getBookmark();
      }
    }
    if (realReportletId != null) {
      ReportEngineService.getInstance().renderReportlet(out,request,doc,realReportletId,format,isMasterPage,isSvg,null,locale,isRtl.booleanValue(),servletPath);
    }
 else {
      ReportEngineService.getInstance().renderReport(out,request,doc,format,viewer.getPageNum(),viewer.getPageRange(),isMasterPage,isSvg,null,locale,isRtl.booleanValue(),servletPath);
    }
  }
  finally {
    if (doc != null)     doc.close();
  }
}