Program: 75015
Project: 75015
Buggy source:
/** 
 * Render reportlet page.
 * @param out
 * @param request
 * @param reportDocument
 * @param reportletId
 * @param format
 * @param masterPage
 * @param pageNumber
 * @param svgFlag
 * @param activeIds
 * @param locale
 * @param rtl
 * @param iServletPath
 * @throws RemoteException
 */
public void renderReportlet(OutputStream out,HttpServletRequest request,IReportDocument reportDocument,String reportletId,String format,boolean masterPage,boolean svgFlag,List activeIds,Locale locale,boolean rtl,String iServletPath) throws RemoteException {
  if (reportDocument == null) {
    AxisFault fault=new AxisFault(BirtResources.getMessage(ResourceConstants.ACTION_EXCEPTION_NO_REPORT_DOCUMENT));
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
  if (out == null)   return;
  String servletPath=iServletPath;
  if (servletPath == null)   servletPath=request.getServletPath();
  IRenderTask renderTask=engine.createRenderTask(reportDocument);
  BirtUtility.addTask(request,renderTask);
  HashMap context=new HashMap();
  context.put(EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,request);
  context.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,ReportEngineService.class.getClassLoader());
  context.put(EngineConstants.APPCONTEXT_CHART_RESOLUTION,ParameterAccessor.getDpi(request));
  ParameterAccessor.pushAppContext(context,request);
  renderTask.setAppContext(context);
  RenderOption renderOption=null;
  if (format == null)   format=ParameterAccessor.getFormat(request);
  if (IBirtConstants.PDF_RENDER_FORMAT.equalsIgnoreCase(format) || IBirtConstants.POSTSCRIPT_RENDER_FORMAT.equalsIgnoreCase(format)) {
    renderOption=createPDFRenderOption(servletPath,request,ParameterAccessor.isDesigner(request));
  }
 else {
    renderOption=createHTMLRenderOption(svgFlag,servletPath,request);
  }
  renderOption.setOutputFormat(format);
  renderOption.setOutputStream(out);
  ViewerHTMLActionHandler handler=null;
  if (IBirtConstants.PDF_RENDER_FORMAT.equalsIgnoreCase(format) || IBirtConstants.POSTSCRIPT_RENDER_FORMAT.equalsIgnoreCase(format)) {
    handler=new ViewerHTMLActionHandler(reportDocument,-1,locale,false,rtl,masterPage,format);
  }
 else {
    boolean isEmbeddable=false;
    if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath) || IBirtConstants.SERVLET_PATH_OUTPUT.equalsIgnoreCase(servletPath))     isEmbeddable=true;
    if (renderOption instanceof IHTMLRenderOption)     ((IHTMLRenderOption)renderOption).setEmbeddable(isEmbeddable);
    if (IBirtConstants.DOC_RENDER_FORMAT.equalsIgnoreCase(format)) {
      ((IHTMLRenderOption)renderOption).setOption(IHTMLRenderOption.HTML_PAGINATION,Boolean.TRUE);
    }
    renderOption.setOption(IHTMLRenderOption.HTML_RTL_FLAG,new Boolean(rtl));
    renderOption.setOption(IHTMLRenderOption.INSTANCE_ID_LIST,activeIds);
    renderOption.setOption(IHTMLRenderOption.MASTER_PAGE_CONTENT,new Boolean(masterPage));
    handler=new ViewerHTMLActionHandler(reportDocument,-1,locale,isEmbeddable,rtl,masterPage,format);
  }
  String resourceFolder=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_RESOURCE_FOLDER);
  handler.setResourceFolder(resourceFolder);
  renderOption.setActionHandler(handler);
  renderTask.setRenderOption(renderOption);
  renderTask.setLocale(locale);
  try {
    if (ParameterAccessor.isIidReportlet(request)) {
      InstanceID instanceId=InstanceID.parse(reportletId);
      renderTask.setInstanceID(instanceId);
    }
 else {
      renderTask.setReportlet(reportletId);
    }
    renderTask.render();
  }
 catch (  Exception e) {
    AxisFault fault=new AxisFault(e.getLocalizedMessage(),e.getCause());
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
 finally {
    BirtUtility.removeTask(request);
    renderTask.close();
  }
}

Fixed version (ground truth):
/** 
 * Render reportlet page.
 * @param out
 * @param request
 * @param reportDocument
 * @param reportletId
 * @param format
 * @param masterPage
 * @param pageNumber
 * @param svgFlag
 * @param activeIds
 * @param locale
 * @param rtl
 * @param iServletPath
 * @throws RemoteException
 */
public void renderReportlet(OutputStream out,HttpServletRequest request,IReportDocument reportDocument,String reportletId,String format,boolean masterPage,boolean svgFlag,List activeIds,Locale locale,boolean rtl,String iServletPath) throws RemoteException {
  if (reportDocument == null) {
    AxisFault fault=new AxisFault(BirtResources.getMessage(ResourceConstants.ACTION_EXCEPTION_NO_REPORT_DOCUMENT));
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
  if (out == null)   return;
  String servletPath=iServletPath;
  if (servletPath == null)   servletPath=request.getServletPath();
  IRenderTask renderTask=engine.createRenderTask(reportDocument);
  BirtUtility.addTask(request,renderTask);
  HashMap context=new HashMap();
  context.put(EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,request);
  context.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,ReportEngineService.class.getClassLoader());
  context.put(EngineConstants.APPCONTEXT_CHART_RESOLUTION,ParameterAccessor.getDpi(request));
  ParameterAccessor.pushAppContext(context,request);
  renderTask.setAppContext(context);
  RenderOption renderOption=null;
  if (format == null)   format=ParameterAccessor.getFormat(request);
  if (IBirtConstants.PDF_RENDER_FORMAT.equalsIgnoreCase(format) || IBirtConstants.POSTSCRIPT_RENDER_FORMAT.equalsIgnoreCase(format)) {
    renderOption=createPDFRenderOption(servletPath,request,ParameterAccessor.isDesigner(request));
  }
 else {
    renderOption=createHTMLRenderOption(svgFlag,servletPath,request);
  }
  renderOption.setOutputFormat(format);
  renderOption.setOutputStream(out);
  ViewerHTMLActionHandler handler=null;
  if (IBirtConstants.PDF_RENDER_FORMAT.equalsIgnoreCase(format) || IBirtConstants.POSTSCRIPT_RENDER_FORMAT.equalsIgnoreCase(format)) {
    handler=new ViewerHTMLActionHandler(reportDocument,-1,locale,false,rtl,masterPage,format);
  }
 else {
    boolean isEmbeddable=false;
    if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath) || IBirtConstants.SERVLET_PATH_OUTPUT.equalsIgnoreCase(servletPath))     isEmbeddable=true;
    if (renderOption instanceof IHTMLRenderOption)     ((IHTMLRenderOption)renderOption).setEmbeddable(isEmbeddable);
    if (IBirtConstants.DOC_RENDER_FORMAT.equalsIgnoreCase(format)) {
      ((IHTMLRenderOption)renderOption).setOption(IHTMLRenderOption.HTML_PAGINATION,Boolean.TRUE);
    }
    renderOption.setOption(IHTMLRenderOption.HTML_RTL_FLAG,new Boolean(rtl));
    renderOption.setOption(IHTMLRenderOption.INSTANCE_ID_LIST,activeIds);
    renderOption.setOption(IHTMLRenderOption.MASTER_PAGE_CONTENT,new Boolean(masterPage));
    handler=new ViewerHTMLActionHandler(reportDocument,-1,locale,isEmbeddable,rtl,masterPage,format);
  }
  String resourceFolder=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_RESOURCE_FOLDER);
  handler.setResourceFolder(resourceFolder);
  renderOption.setActionHandler(handler);
  String reportTitle=ParameterAccessor.getTitle(request);
  if (reportTitle != null)   renderOption.setOption(IHTMLRenderOption.HTML_TITLE,reportTitle);
  renderTask.setRenderOption(renderOption);
  renderTask.setLocale(locale);
  try {
    if (ParameterAccessor.isIidReportlet(request)) {
      InstanceID instanceId=InstanceID.parse(reportletId);
      renderTask.setInstanceID(instanceId);
    }
 else {
      renderTask.setReportlet(reportletId);
    }
    renderTask.render();
  }
 catch (  Exception e) {
    AxisFault fault=new AxisFault(e.getLocalizedMessage(),e.getCause());
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
 finally {
    BirtUtility.removeTask(request);
    renderTask.close();
  }
}