Program: 115281
Project: 115281
Buggy source:
@Override protected void processRequest() throws Exception {
  FormProcessor fp=new FormProcessor(request);
  String fileName=request.getParameter("String_Node_Str");
  if (fileName != null) {
    fileName=fileName.replaceAll("String_Node_Str","String_Node_Str");
  }
  fileName=fileName == null ? "String_Node_Str" : fileName;
  String format=request.getParameter("String_Node_Str");
  String studyIdentifier=request.getParameter("String_Node_Str");
  int subjectId=fp.getInt("String_Node_Str");
  int discNoteType=fp.getInt("String_Node_Str");
  DownloadDiscrepancyNote downLoader=new DownloadDiscrepancyNote();
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    fileName=fileName + "String_Node_Str";
    response.setContentType(DownloadDiscrepancyNote.CSV);
  }
 else {
    response.setContentType(DownloadDiscrepancyNote.PDF);
    fileName=fileName + "String_Node_Str";
  }
  response.addHeader(CONTENT_DISPOSITION_HEADER,CONTENT_DISPOSITION_VALUE + fileName);
  StudyBean studyBean=(StudyBean)session.getAttribute("String_Node_Str");
  Set<Integer> resolutionStatusIds=(HashSet)session.getAttribute("String_Node_Str");
  ListNotesFilter listNotesFilter=new ListNotesFilter();
  StudySubjectBean studySubject=new StudySubjectBean();
  if (subjectId > 0) {
    studySubject=(StudySubjectBean)new StudySubjectDAO(sm.getDataSource()).findByPK(subjectId);
    listNotesFilter.addFilter("String_Node_Str",studySubject.getLabel());
  }
  if (discNoteType >= 1 && discNoteType <= 5) {
    listNotesFilter.addFilter("String_Node_Str",discNoteType);
  }
  if (resolutionStatusIds != null && !resolutionStatusIds.isEmpty()) {
    for (    Integer statusId : resolutionStatusIds) {
      listNotesFilter.addFilter("String_Node_Str",statusId);
    }
  }
  ListNotesSort listNotesSort=new ListNotesSort();
  listNotesSort.addSort("String_Node_Str","String_Node_Str");
  ArrayList<DiscrepancyNoteBean> allDiscNotes=new DiscrepancyNoteDAO(sm.getDataSource()).getNotesWithFilterAndSort(studyBean,listNotesFilter,listNotesSort);
  allDiscNotes=populateRowsWithAttachedData(allDiscNotes);
  DiscrepancyNoteUtil discNoteUtil=new DiscrepancyNoteUtil();
  List<DiscrepancyNoteThread> discrepancyNoteThreads=discNoteUtil.createThreads(allDiscNotes,sm.getDataSource(),studyBean,resolutionStatusIds,discNoteType);
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    int contentLen=downLoader.getThreadListContentLength(discrepancyNoteThreads);
    response.setContentLength(contentLen);
    downLoader.downLoadThreadedDiscBeans(discrepancyNoteThreads,DownloadDiscrepancyNote.CSV,response.getOutputStream(),null);
  }
 else {
    response.setHeader("String_Node_Str","String_Node_Str");
    downLoader.downLoadThreadedDiscBeans(discrepancyNoteThreads,DownloadDiscrepancyNote.PDF,response.getOutputStream(),studyIdentifier);
  }
}

Fixed version (ground truth):
@Override protected void processRequest() throws Exception {
  FormProcessor fp=new FormProcessor(request);
  String fileName=request.getParameter("String_Node_Str");
  if (fileName != null) {
    fileName=fileName.replaceAll("String_Node_Str","String_Node_Str");
  }
  fileName=fileName == null ? "String_Node_Str" : fileName;
  String format=request.getParameter("String_Node_Str");
  String studyIdentifier=request.getParameter("String_Node_Str");
  int subjectId=fp.getInt("String_Node_Str");
  int discNoteType=fp.getInt("String_Node_Str");
  DownloadDiscrepancyNote downLoader=new DownloadDiscrepancyNote();
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    fileName=fileName + "String_Node_Str";
    response.setContentType(DownloadDiscrepancyNote.CSV);
  }
 else {
    response.setContentType(DownloadDiscrepancyNote.PDF);
    fileName=fileName + "String_Node_Str";
  }
  response.addHeader(CONTENT_DISPOSITION_HEADER,CONTENT_DISPOSITION_VALUE + fileName);
  StudyBean studyBean=(StudyBean)session.getAttribute("String_Node_Str");
  Set<Integer> resolutionStatusIds=(HashSet)session.getAttribute("String_Node_Str");
  ListNotesFilter listNotesFilter=new ListNotesFilter();
  StudySubjectBean studySubject=new StudySubjectBean();
  if (subjectId > 0) {
    studySubject=(StudySubjectBean)new StudySubjectDAO(sm.getDataSource()).findByPK(subjectId);
    listNotesFilter.addFilter("String_Node_Str",studySubject.getLabel());
  }
  if (discNoteType >= 1 && discNoteType <= 5) {
    listNotesFilter.addFilter("String_Node_Str",discNoteType);
  }
  if (resolutionStatusIds != null && !resolutionStatusIds.isEmpty()) {
    for (    Integer statusId : resolutionStatusIds) {
      listNotesFilter.addFilter("String_Node_Str",statusId);
    }
  }
  ListNotesSort listNotesSort=new ListNotesSort();
  listNotesSort.addSort("String_Node_Str","String_Node_Str");
  ArrayList<DiscrepancyNoteBean> allDiscNotes=new DiscrepancyNoteDAO(sm.getDataSource()).getNotesWithFilterAndSort(studyBean,listNotesFilter,listNotesSort);
  allDiscNotes=populateRowsWithAttachedData(allDiscNotes);
  ArrayList sessionNotes=(ArrayList)session.getAttribute("String_Node_Str");
  if (sessionNotes != null) {
    allDiscNotes=sessionNotes;
  }
  DiscrepancyNoteUtil discNoteUtil=new DiscrepancyNoteUtil();
  List<DiscrepancyNoteThread> discrepancyNoteThreads=discNoteUtil.createThreads(allDiscNotes,sm.getDataSource(),studyBean,resolutionStatusIds,discNoteType);
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    int contentLen=downLoader.getThreadListContentLength(discrepancyNoteThreads);
    response.setContentLength(contentLen);
    downLoader.downLoadThreadedDiscBeans(discrepancyNoteThreads,DownloadDiscrepancyNote.CSV,response.getOutputStream(),null);
  }
 else {
    response.setHeader("String_Node_Str","String_Node_Str");
    downLoader.downLoadThreadedDiscBeans(discrepancyNoteThreads,DownloadDiscrepancyNote.PDF,response.getOutputStream(),studyIdentifier);
  }
}