Program: 76676
Project: 76676
Buggy source:
/** 
 * Render the report in html/pdf format by calling engine service.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 */
protected void doService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  ServletOutputStream out=response.getOutputStream();
  GetUpdatedObjectsResponse upResponse=new GetUpdatedObjectsResponse();
  IContext context=new BirtContext(request,response);
  Operation op=null;
  try {
    if (IBirtConstants.SERVLET_PATH_DOWNLOAD.equalsIgnoreCase(request.getServletPath())) {
      BirtExtractDataActionHandler extractDataHandler=new BirtExtractDataActionHandler(context,op,upResponse);
      extractDataHandler.execute();
    }
 else     if (ParameterAccessor.isGetImageOperator(request)) {
      BirtRenderImageActionHandler renderImageHandler=new BirtRenderImageActionHandler(context,op,upResponse);
      renderImageHandler.execute();
    }
 else     if (ParameterAccessor.isGetReportlet(request)) {
      BirtGetReportletActionHandler getReportletHandler=new BirtGetReportletActionHandler(context,op,upResponse);
      getReportletHandler.execute();
    }
 else     if (context.getBean().documentInUrl) {
      BirtRenderReportActionHandler runReportHandler=new BirtRenderReportActionHandler(context,op,upResponse,out);
      runReportHandler.execute();
    }
 else {
      BirtRunAndRenderActionHandler runAndRenderHandler=new BirtRunAndRenderActionHandler(context,op,upResponse);
      runAndRenderHandler.execute();
    }
  }
 catch (  RemoteException e) {
    AxisFault fault=(AxisFault)e;
    response.setContentType("String_Node_Str");
    String message="String_Node_Str" + BirtResources.getMessage("String_Node_Str") + "String_Node_Str"+ ParameterAccessor.htmlEncode(fault.getFaultString())+ "String_Node_Str";
    out.write(message.getBytes());
    out.flush();
    out.close();
  }
}

Fixed version (ground truth):
/** 
 * Render the report in html/pdf format by calling engine service.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 */
protected void doService(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  ServletOutputStream out=response.getOutputStream();
  GetUpdatedObjectsResponse upResponse=new GetUpdatedObjectsResponse();
  IContext context=new BirtContext(request,response);
  Operation op=null;
  try {
    if (IBirtConstants.SERVLET_PATH_DOWNLOAD.equalsIgnoreCase(request.getServletPath())) {
      BirtExtractDataActionHandler extractDataHandler=new BirtExtractDataActionHandler(context,op,upResponse);
      extractDataHandler.execute();
    }
 else     if (ParameterAccessor.isGetImageOperator(request)) {
      BirtRenderImageActionHandler renderImageHandler=new BirtRenderImageActionHandler(context,op,upResponse);
      renderImageHandler.execute();
    }
 else     if (ParameterAccessor.isGetReportlet(request)) {
      BirtGetReportletActionHandler getReportletHandler=new BirtGetReportletActionHandler(context,op,upResponse);
      getReportletHandler.execute();
    }
 else     if (context.getBean().documentInUrl) {
      BirtRenderReportActionHandler runReportHandler=new BirtRenderReportActionHandler(context,op,upResponse,out);
      runReportHandler.execute();
    }
 else {
      BirtRunAndRenderActionHandler runAndRenderHandler=new BirtRunAndRenderActionHandler(context,op,upResponse);
      runAndRenderHandler.execute();
    }
  }
 catch (  RemoteException e) {
    if (!ParameterAccessor.isGetImageOperator(request)) {
      AxisFault fault=(AxisFault)e;
      response.setContentType("String_Node_Str");
      String message="String_Node_Str" + BirtResources.getMessage("String_Node_Str") + "String_Node_Str"+ ParameterAccessor.htmlEncode(fault.getFaultString())+ "String_Node_Str";
      out.write(message.getBytes());
      out.flush();
      out.close();
    }
  }
}