Program: 72439
Project: 72439
Buggy source:
/** 
 * Creates a new render task and configure it.
 * @param out output stream
 * @param reportDocument report document
 * @param inputOptions input options
 * @param pageNumber page number
 * @param activeIds active IDs
 * @return configured render task
 * @throws AxisFault
 */
private IRenderTask createRenderTask(OutputStream out,IReportDocument reportDocument,InputOptions inputOptions,long pageNumber,List activeIds) throws AxisFault {
  HttpServletRequest request=(HttpServletRequest)inputOptions.getOption(InputOptions.OPT_REQUEST);
  Locale locale=(Locale)inputOptions.getOption(InputOptions.OPT_LOCALE);
  Boolean isMasterPageContent=(Boolean)inputOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  boolean masterPage=isMasterPageContent == null ? true : isMasterPageContent.booleanValue();
  Boolean svgFlag=(Boolean)inputOptions.getOption(InputOptions.OPT_SVG_FLAG);
  Boolean isRtl=(Boolean)inputOptions.getOption(InputOptions.OPT_RTL);
  boolean rtl=isRtl.booleanValue();
  String format=(String)inputOptions.getOption(InputOptions.OPT_FORMAT);
  String emitterId=(String)inputOptions.getOption(InputOptions.OPT_EMITTER_ID);
  String iServletPath=(String)inputOptions.getOption(InputOptions.OPT_SERVLET_PATH);
  if (reportDocument == null) {
    AxisFault fault=new AxisFault(BirtResources.getMessage(ResourceConstants.ACTION_EXCEPTION_NO_REPORT_DOCUMENT));
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
  String servletPath=iServletPath;
  if (servletPath == null)   servletPath=request.getServletPath();
  IRenderTask renderTask=engine.createRenderTask(reportDocument);
  BirtUtility.addTask(request,renderTask);
  Map context=BirtUtility.getAppContext(request);
  renderTask.setAppContext(context);
  RenderOption renderOption=null;
  if (format == null)   format=ParameterAccessor.getFormat(request);
  if (ParameterAccessor.isPDFLayout(format)) {
    renderOption=createPDFRenderOption(servletPath,request,ParameterAccessor.isDesigner());
  }
 else {
    if (!IBirtConstants.HTML_RENDER_FORMAT.equalsIgnoreCase(format))     svgFlag=false;
    renderOption=createHTMLRenderOption(svgFlag,servletPath,request);
  }
  if (!IBirtConstants.EXCEL_RENDER_FORMAT.equalsIgnoreCase(format)) {
    ((IRenderOption)renderOption).setOption(IRenderOption.HTML_PAGINATION,Boolean.TRUE);
  }
  renderOption.setOutputStream(out);
  renderOption.setOutputFormat(format);
  renderOption.setEmitterID(emitterId);
  ViewerHTMLActionHandler handler=null;
  if (ParameterAccessor.isPDFLayout(format)) {
    handler=new ViewerHTMLActionHandler(reportDocument,pageNumber,locale,false,rtl,masterPage,format,new Boolean(svgFlag),ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_DESIGNER));
  }
 else {
    boolean isEmbeddable=false;
    if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath) || IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(servletPath))     isEmbeddable=true;
    if (renderOption instanceof IHTMLRenderOption)     ((IHTMLRenderOption)renderOption).setEmbeddable(isEmbeddable);
    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,pageNumber,locale,isEmbeddable,rtl,masterPage,format,new Boolean(svgFlag),ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_DESIGNER));
  }
  String resourceFolder=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_RESOURCE_FOLDER);
  handler.setResourceFolder(resourceFolder);
  renderOption.setActionHandler(handler);
  if (pageNumber > 0) {
    initializeEmitterConfigs(request,renderOption.getOptions());
  }
  String reportTitle=ParameterAccessor.htmlDecode(ParameterAccessor.getTitle(request));
  if (reportTitle != null)   renderOption.setOption(IHTMLRenderOption.HTML_TITLE,reportTitle);
  renderTask.setRenderOption(renderOption);
  renderTask.setLocale(locale);
  return renderTask;
}

Fixed version (ground truth):
/** 
 * Creates a new render task and configure it.
 * @param out output stream
 * @param reportDocument report document
 * @param inputOptions input options
 * @param pageNumber page number
 * @param activeIds active IDs
 * @return configured render task
 * @throws AxisFault
 */
private IRenderTask createRenderTask(OutputStream out,IReportDocument reportDocument,InputOptions inputOptions,long pageNumber,List activeIds) throws AxisFault {
  HttpServletRequest request=(HttpServletRequest)inputOptions.getOption(InputOptions.OPT_REQUEST);
  Locale locale=(Locale)inputOptions.getOption(InputOptions.OPT_LOCALE);
  Boolean isMasterPageContent=(Boolean)inputOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  boolean masterPage=isMasterPageContent == null ? true : isMasterPageContent.booleanValue();
  Boolean svgFlag=(Boolean)inputOptions.getOption(InputOptions.OPT_SVG_FLAG);
  Boolean isRtl=(Boolean)inputOptions.getOption(InputOptions.OPT_RTL);
  boolean rtl=isRtl.booleanValue();
  String format=(String)inputOptions.getOption(InputOptions.OPT_FORMAT);
  String emitterId=(String)inputOptions.getOption(InputOptions.OPT_EMITTER_ID);
  String iServletPath=(String)inputOptions.getOption(InputOptions.OPT_SERVLET_PATH);
  if (reportDocument == null) {
    AxisFault fault=new AxisFault(BirtResources.getMessage(ResourceConstants.ACTION_EXCEPTION_NO_REPORT_DOCUMENT));
    fault.setFaultCode(new QName("String_Node_Str"));
    throw fault;
  }
  String servletPath=iServletPath;
  if (servletPath == null)   servletPath=request.getServletPath();
  IRenderTask renderTask=engine.createRenderTask(reportDocument);
  BirtUtility.addTask(request,renderTask);
  Map context=BirtUtility.getAppContext(request);
  renderTask.setAppContext(context);
  RenderOption renderOption=null;
  if (format == null)   format=ParameterAccessor.getFormat(request);
  if (ParameterAccessor.isPDFLayout(format)) {
    renderOption=createPDFRenderOption(servletPath,request,ParameterAccessor.isDesigner());
  }
 else {
    if (!IBirtConstants.HTML_RENDER_FORMAT.equalsIgnoreCase(format))     svgFlag=false;
    renderOption=createHTMLRenderOption(svgFlag,servletPath,request);
  }
  if (!IBirtConstants.EXCEL_RENDER_FORMAT.equalsIgnoreCase(format)) {
    ((IRenderOption)renderOption).setOption(IRenderOption.HTML_PAGINATION,Boolean.TRUE);
  }
  renderOption.setOutputStream(out);
  renderOption.setOutputFormat(format);
  renderOption.setEmitterID(emitterId);
  ViewerHTMLActionHandler handler=null;
  if (ParameterAccessor.isPDFLayout(format)) {
    handler=new ViewerHTMLActionHandler(reportDocument,pageNumber,locale,false,rtl,masterPage,format,new Boolean(svgFlag),ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_DESIGNER));
  }
 else {
    boolean isEmbeddable=false;
    if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath) || IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(servletPath))     isEmbeddable=true;
    if (renderOption instanceof IHTMLRenderOption)     ((IHTMLRenderOption)renderOption).setEmbeddable(isEmbeddable);
    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,pageNumber,locale,isEmbeddable,rtl,masterPage,format,new Boolean(svgFlag),ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_DESIGNER));
  }
  handler.setPageOverflow(request.getParameter(ParameterAccessor.PARAM_PAGE_OVERFLOW));
  String resourceFolder=ParameterAccessor.getParameter(request,ParameterAccessor.PARAM_RESOURCE_FOLDER);
  handler.setResourceFolder(resourceFolder);
  renderOption.setActionHandler(handler);
  if (pageNumber > 0) {
    initializeEmitterConfigs(request,renderOption.getOptions());
  }
  String reportTitle=ParameterAccessor.htmlDecode(ParameterAccessor.getTitle(request));
  if (reportTitle != null)   renderOption.setOption(IHTMLRenderOption.HTML_TITLE,reportTitle);
  renderTask.setRenderOption(renderOption);
  renderTask.setLocale(locale);
  return renderTask;
}