Program: 115289
Project: 115289
Buggy source:
@Override protected void processRequest() throws Exception {
  String module=request.getParameter("String_Node_Str");
  String moduleStr="String_Node_Str";
  if (module != null && module.trim().length() > 0) {
    if ("String_Node_Str".equals(module)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
      moduleStr="String_Node_Str";
    }
 else     if ("String_Node_Str".equals(module)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
      moduleStr="String_Node_Str";
    }
 else {
      request.setAttribute("String_Node_Str","String_Node_Str");
    }
  }
  FormProcessor fp=new FormProcessor(request);
  if (fp.getString("String_Node_Str").equals("String_Node_Str")) {
    showMoreLink=true;
  }
 else {
    showMoreLink=Boolean.parseBoolean(fp.getString("String_Node_Str"));
  }
  int oneSubjectId=fp.getInt("String_Node_Str");
  session.setAttribute("String_Node_Str",oneSubjectId);
  int resolutionStatusSubj=fp.getInt(RESOLUTION_STATUS);
  int discNoteType=0;
  try {
    discNoteType=Integer.parseInt(request.getParameter("String_Node_Str"));
  }
 catch (  NumberFormatException nfe) {
    discNoteType=-1;
  }
  request.setAttribute(DISCREPANCY_NOTE_TYPE,discNoteType);
  boolean removeSession=fp.getBoolean("String_Node_Str");
  session.setAttribute("String_Node_Str",module);
  String viewForOne=fp.getString("String_Node_Str");
  boolean isForOneSubjectsNotes="String_Node_Str".equalsIgnoreCase(viewForOne);
  DiscrepancyNoteDAO dndao=new DiscrepancyNoteDAO(sm.getDataSource());
  StudyDAO studyDAO=new StudyDAO(sm.getDataSource());
  dndao.setFetchMapping(true);
  int resolutionStatus=0;
  try {
    resolutionStatus=Integer.parseInt(request.getParameter("String_Node_Str"));
  }
 catch (  NumberFormatException nfe) {
    resolutionStatus=-1;
  }
  if (removeSession) {
    session.removeAttribute(WIN_LOCATION);
    session.removeAttribute(NOTES_TABLE);
  }
  session.setAttribute(WIN_LOCATION,"String_Node_Str" + viewForOne + "String_Node_Str"+ oneSubjectId+ "String_Node_Str"+ module+ "String_Node_Str");
  boolean hasAResolutionStatus=resolutionStatus >= 1 && resolutionStatus <= 5;
  Set<Integer> resolutionStatusIds=(HashSet)session.getAttribute(RESOLUTION_STATUS);
  if (!hasAResolutionStatus && resolutionStatusIds != null) {
    session.removeAttribute(RESOLUTION_STATUS);
    resolutionStatusIds=null;
  }
  if (hasAResolutionStatus) {
    if (resolutionStatusIds == null) {
      resolutionStatusIds=new HashSet<Integer>();
    }
    resolutionStatusIds.add(resolutionStatus);
    session.setAttribute(RESOLUTION_STATUS,resolutionStatusIds);
  }
  DiscrepancyNoteUtil discNoteUtil=new DiscrepancyNoteUtil();
  Map stats=discNoteUtil.generateDiscNoteSummaryRefactored(sm.getDataSource(),currentStudy,resolutionStatusIds,discNoteType);
  request.setAttribute("String_Node_Str",stats);
  Set mapKeys=stats.keySet();
  request.setAttribute("String_Node_Str",mapKeys);
  StudySubjectDAO subdao=new StudySubjectDAO(sm.getDataSource());
  StudyDAO studyDao=new StudyDAO(sm.getDataSource());
  SubjectDAO sdao=new SubjectDAO(sm.getDataSource());
  UserAccountDAO uadao=new UserAccountDAO(sm.getDataSource());
  CRFVersionDAO crfVersionDao=new CRFVersionDAO(sm.getDataSource());
  CRFDAO crfDao=new CRFDAO(sm.getDataSource());
  StudyEventDAO studyEventDao=new StudyEventDAO(sm.getDataSource());
  StudyEventDefinitionDAO studyEventDefinitionDao=new StudyEventDefinitionDAO(sm.getDataSource());
  EventDefinitionCRFDAO eventDefinitionCRFDao=new EventDefinitionCRFDAO(sm.getDataSource());
  ItemDataDAO itemDataDao=new ItemDataDAO(sm.getDataSource());
  ItemDAO itemDao=new ItemDAO(sm.getDataSource());
  EventCRFDAO eventCRFDao=new EventCRFDAO(sm.getDataSource());
  ListNotesTableFactory factory=new ListNotesTableFactory(showMoreLink);
  factory.setSubjectDao(sdao);
  factory.setStudySubjectDao(subdao);
  factory.setUserAccountDao(uadao);
  factory.setStudyDao(studyDao);
  factory.setCurrentStudy(currentStudy);
  factory.setDiscrepancyNoteDao(dndao);
  factory.setCrfDao(crfDao);
  factory.setCrfVersionDao(crfVersionDao);
  factory.setStudyEventDao(studyEventDao);
  factory.setStudyEventDefinitionDao(studyEventDefinitionDao);
  factory.setEventDefinitionCRFDao(eventDefinitionCRFDao);
  factory.setItemDao(itemDao);
  factory.setItemDataDao(itemDataDao);
  factory.setEventCRFDao(eventCRFDao);
  factory.setModule(moduleStr);
  factory.setDiscNoteType(discNoteType);
  factory.setResolutionStatus(resolutionStatus);
  String viewNotesHtml=factory.createTable(request,response).render();
  request.setAttribute("String_Node_Str",viewNotesHtml);
  String viewNotesURL=this.getPageURL();
  session.setAttribute("String_Node_Str",viewNotesURL);
  String viewNotesPageFileName=this.getPageServletFileName();
  session.setAttribute("String_Node_Str",viewNotesPageFileName);
  if ("String_Node_Str".equalsIgnoreCase(fp.getString(PRINT))) {
    List allNotes=dndao.findAllDiscrepancyNotesDataByStudy(currentStudy);
    request.setAttribute("String_Node_Str",factory.populateDataInNote(allNotes));
    forwardPage(Page.VIEW_DISCREPANCY_NOTES_IN_STUDY_PRINT);
  }
 else {
    forwardPage(Page.VIEW_DISCREPANCY_NOTES_IN_STUDY);
  }
}

Fixed version (ground truth):
@Override protected void processRequest() throws Exception {
  String module=request.getParameter("String_Node_Str");
  String moduleStr="String_Node_Str";
  if (module != null && module.trim().length() > 0) {
    if ("String_Node_Str".equals(module)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
      moduleStr="String_Node_Str";
    }
 else     if ("String_Node_Str".equals(module)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
      moduleStr="String_Node_Str";
    }
 else {
      request.setAttribute("String_Node_Str","String_Node_Str");
    }
  }
  FormProcessor fp=new FormProcessor(request);
  if (fp.getString("String_Node_Str").equals("String_Node_Str")) {
    showMoreLink=true;
  }
 else {
    showMoreLink=Boolean.parseBoolean(fp.getString("String_Node_Str"));
  }
  int oneSubjectId=fp.getInt("String_Node_Str");
  session.setAttribute("String_Node_Str",oneSubjectId);
  int resolutionStatusSubj=fp.getInt(RESOLUTION_STATUS);
  int discNoteType=0;
  try {
    discNoteType=Integer.parseInt(request.getParameter("String_Node_Str"));
  }
 catch (  NumberFormatException nfe) {
    discNoteType=-1;
  }
  request.setAttribute(DISCREPANCY_NOTE_TYPE,discNoteType);
  boolean removeSession=fp.getBoolean("String_Node_Str");
  session.setAttribute("String_Node_Str",module);
  String viewForOne=fp.getString("String_Node_Str");
  boolean isForOneSubjectsNotes="String_Node_Str".equalsIgnoreCase(viewForOne);
  DiscrepancyNoteDAO dndao=new DiscrepancyNoteDAO(sm.getDataSource());
  StudyDAO studyDAO=new StudyDAO(sm.getDataSource());
  dndao.setFetchMapping(true);
  int resolutionStatus=0;
  try {
    resolutionStatus=Integer.parseInt(request.getParameter("String_Node_Str"));
  }
 catch (  NumberFormatException nfe) {
    resolutionStatus=-1;
  }
  if (removeSession) {
    session.removeAttribute(WIN_LOCATION);
    session.removeAttribute(NOTES_TABLE);
  }
  session.setAttribute(WIN_LOCATION,"String_Node_Str" + viewForOne + "String_Node_Str"+ oneSubjectId+ "String_Node_Str"+ module+ "String_Node_Str");
  boolean hasAResolutionStatus=resolutionStatus >= 1 && resolutionStatus <= 5;
  Set<Integer> resolutionStatusIds=(HashSet)session.getAttribute(RESOLUTION_STATUS);
  if (!hasAResolutionStatus && resolutionStatusIds != null) {
    session.removeAttribute(RESOLUTION_STATUS);
    resolutionStatusIds=null;
  }
  if (hasAResolutionStatus) {
    if (resolutionStatusIds == null) {
      resolutionStatusIds=new HashSet<Integer>();
    }
    resolutionStatusIds.add(resolutionStatus);
    session.setAttribute(RESOLUTION_STATUS,resolutionStatusIds);
  }
  DiscrepancyNoteUtil discNoteUtil=new DiscrepancyNoteUtil();
  Map stats=discNoteUtil.generateDiscNoteSummaryRefactored(sm.getDataSource(),currentStudy,resolutionStatusIds,discNoteType);
  request.setAttribute("String_Node_Str",stats);
  Set mapKeys=stats.keySet();
  request.setAttribute("String_Node_Str",mapKeys);
  StudySubjectDAO subdao=new StudySubjectDAO(sm.getDataSource());
  StudyDAO studyDao=new StudyDAO(sm.getDataSource());
  SubjectDAO sdao=new SubjectDAO(sm.getDataSource());
  UserAccountDAO uadao=new UserAccountDAO(sm.getDataSource());
  CRFVersionDAO crfVersionDao=new CRFVersionDAO(sm.getDataSource());
  CRFDAO crfDao=new CRFDAO(sm.getDataSource());
  StudyEventDAO studyEventDao=new StudyEventDAO(sm.getDataSource());
  StudyEventDefinitionDAO studyEventDefinitionDao=new StudyEventDefinitionDAO(sm.getDataSource());
  EventDefinitionCRFDAO eventDefinitionCRFDao=new EventDefinitionCRFDAO(sm.getDataSource());
  ItemDataDAO itemDataDao=new ItemDataDAO(sm.getDataSource());
  ItemDAO itemDao=new ItemDAO(sm.getDataSource());
  EventCRFDAO eventCRFDao=new EventCRFDAO(sm.getDataSource());
  ListNotesTableFactory factory=new ListNotesTableFactory(showMoreLink);
  factory.setSubjectDao(sdao);
  factory.setStudySubjectDao(subdao);
  factory.setUserAccountDao(uadao);
  factory.setStudyDao(studyDao);
  factory.setCurrentStudy(currentStudy);
  factory.setDiscrepancyNoteDao(dndao);
  factory.setCrfDao(crfDao);
  factory.setCrfVersionDao(crfVersionDao);
  factory.setStudyEventDao(studyEventDao);
  factory.setStudyEventDefinitionDao(studyEventDefinitionDao);
  factory.setEventDefinitionCRFDao(eventDefinitionCRFDao);
  factory.setItemDao(itemDao);
  factory.setItemDataDao(itemDataDao);
  factory.setEventCRFDao(eventCRFDao);
  factory.setModule(moduleStr);
  factory.setDiscNoteType(discNoteType);
  factory.setResolutionStatus(resolutionStatus);
  String viewNotesHtml=factory.createTable(request,response).render();
  request.setAttribute("String_Node_Str",viewNotesHtml);
  String viewNotesURL=this.getPageURL();
  session.setAttribute("String_Node_Str",viewNotesURL);
  String viewNotesPageFileName=this.getPageServletFileName();
  session.setAttribute("String_Node_Str",viewNotesPageFileName);
  if ("String_Node_Str".equalsIgnoreCase(fp.getString(PRINT))) {
    List allNotes=ListNotesTableFactory.getNotesForPrintPop();
    request.setAttribute("String_Node_Str",factory.populateDataInNote(allNotes));
    forwardPage(Page.VIEW_DISCREPANCY_NOTES_IN_STUDY_PRINT);
  }
 else {
    forwardPage(Page.VIEW_DISCREPANCY_NOTES_IN_STUDY);
  }
}