Program: 86837
Project: 86837
Buggy source:
/** 
 * The onSubmit function receives the form/command object that was modified by the input form and saves it to the db
 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException)
 */
protected ModelAndView onSubmit(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  ReportData report=(ReportData)request.getSession().getAttribute(ReportingConstants.OPENMRS_REPORT_DATA);
  if (Context.isAuthenticated() && report != null && "String_Node_Str".equals(request.getParameter("String_Node_Str"))) {
    ReportDefinition reportDefinition=report.getDefinition();
    ReportService reportService=(ReportService)Context.getService(ReportService.class);
    String renderClass=request.getParameter("String_Node_Str");
    String renderArg="String_Node_Str";
    if (renderClass.indexOf("String_Node_Str") > 0) {
      int ind=renderClass.indexOf("String_Node_Str");
      renderArg=renderClass.substring(ind + 1);
      renderClass=renderClass.substring(0,ind);
    }
    ReportRenderer renderer=new IndicatorReportRenderer();
    log.info("String_Node_Str" + renderer.getClass() + "String_Node_Str"+ renderArg);
    if (renderer instanceof WebReportRenderer) {
      WebReportRenderer webRenderer=(WebReportRenderer)renderer;
      if (webRenderer.getLinkUrl(reportDefinition) != null) {
        request.getSession().setAttribute(ReportingConstants.OPENMRS_REPORT_DATA,report);
        request.getSession().setAttribute(ReportingConstants.OPENMRS_REPORT_ARGUMENT,renderArg);
        String url=webRenderer.getLinkUrl(reportDefinition);
        if (!url.startsWith("String_Node_Str"))         url="String_Node_Str" + url;
        url=request.getContextPath() + url;
        return new ModelAndView(new RedirectView(url));
      }
    }
    String filename=renderer.getFilename(reportDefinition,renderArg).replace("String_Node_Str","String_Node_Str");
    response.setContentType(renderer.getRenderedContentType(reportDefinition,renderArg));
    response.setHeader("String_Node_Str","String_Node_Str" + filename);
    response.setHeader("String_Node_Str","String_Node_Str");
    renderer.render(report,renderArg,response.getOutputStream());
    return null;
  }
 else {
    String view=getFormView();
    return new ModelAndView(new RedirectView(view));
  }
}

Fixed version (ground truth):
/** 
 * The onSubmit function receives the form/command object that was modified by the input form and saves it to the db
 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.validation.BindException)
 */
protected ModelAndView onSubmit(HttpServletRequest request,HttpServletResponse response,Object obj,BindException errors) throws Exception {
  ReportData report=(ReportData)request.getSession().getAttribute(ReportingConstants.OPENMRS_REPORT_DATA);
  if (Context.isAuthenticated() && report != null && "String_Node_Str".equals(request.getParameter("String_Node_Str"))) {
    ReportDefinition reportDefinition=report.getDefinition();
    String renderClass=request.getParameter("String_Node_Str");
    String renderArg="String_Node_Str";
    if (renderClass.indexOf("String_Node_Str") > 0) {
      int ind=renderClass.indexOf("String_Node_Str");
      renderArg=renderClass.substring(ind + 1);
      renderClass=renderClass.substring(0,ind);
    }
    ReportRenderer renderer=new IndicatorReportRenderer();
    log.info("String_Node_Str" + renderer.getClass() + "String_Node_Str"+ renderArg);
    if (renderer instanceof WebReportRenderer) {
      WebReportRenderer webRenderer=(WebReportRenderer)renderer;
      if (webRenderer.getLinkUrl(reportDefinition) != null) {
        request.getSession().setAttribute(ReportingConstants.OPENMRS_REPORT_DATA,report);
        request.getSession().setAttribute(ReportingConstants.OPENMRS_REPORT_ARGUMENT,renderArg);
        String url=webRenderer.getLinkUrl(reportDefinition);
        if (!url.startsWith("String_Node_Str"))         url="String_Node_Str" + url;
        url=request.getContextPath() + url;
        return new ModelAndView(new RedirectView(url));
      }
    }
    String filename=renderer.getFilename(reportDefinition,renderArg).replace("String_Node_Str","String_Node_Str");
    response.setContentType(renderer.getRenderedContentType(reportDefinition,renderArg));
    response.setHeader("String_Node_Str","String_Node_Str" + filename);
    response.setHeader("String_Node_Str","String_Node_Str");
    renderer.render(report,renderArg,response.getOutputStream());
    return null;
  }
 else {
    String view=getFormView();
    return new ModelAndView(new RedirectView(view));
  }
}