Program: 115034
Project: 115034
Buggy source:
@Override public void processRequest() throws Exception {
  FormProcessor fp=new FormProcessor(request);
  ub.incNumVisitsToMainMenu();
  session.setAttribute(USER_BEAN_NAME,ub);
  request.setAttribute("String_Node_Str",true);
  request.setAttribute("String_Node_Str",false);
  if (ub == null || ub.getId() == 0) {
    forwardPage(Page.MENU,false);
    return;
  }
  StudyDAO sdao=new StudyDAO(sm.getDataSource());
  ArrayList studies=null;
  long pwdExpireDay=new Long(SQLInitServlet.getField("String_Node_Str")).longValue();
  Date lastPwdChangeDate=ub.getPasswdTimestamp();
  int pwdChangeRequired=new Integer(SQLInitServlet.getField("String_Node_Str")).intValue();
  UserAccountDAO udao=new UserAccountDAO(sm.getDataSource());
  UserAccountBean ub1=(UserAccountBean)udao.findByPK(ub.getId());
  ub1.setLastVisitDate(new Date(System.currentTimeMillis()));
  ub1.setOwner(ub1);
  ub1.setUpdater(ub1);
  udao.update(ub1);
  if (currentStudy != null) {
    request.setAttribute("String_Node_Str",currentStudy.getId());
    request.setAttribute("String_Node_Str",super.getEventDefinitionsByCurrentStudy());
    request.setAttribute("String_Node_Str",super.getStudyGroupClassesByCurrentStudy());
  }
  if (ub.isLdapUser()) {
    lastPwdChangeDate=new Date();
  }
  logger.info("String_Node_Str" + ub.isLdapUser());
  if ((lastPwdChangeDate != null) || ((lastPwdChangeDate == null) && (pwdChangeRequired == 0))) {
    if (lastPwdChangeDate != null) {
      Calendar cal=Calendar.getInstance();
      long difference=Math.abs(cal.getTime().getTime() - lastPwdChangeDate.getTime());
      long days=difference / (1000 * 60 * 60* 24);
      session.setAttribute("String_Node_Str","String_Node_Str");
      if (!ub.isLdapUser() && pwdExpireDay > 0 && days >= pwdExpireDay) {
        System.out.println("String_Node_Str");
        studies=(ArrayList)sdao.findAllByUser(ub.getName());
        request.setAttribute("String_Node_Str",studies);
        session.setAttribute("String_Node_Str",ub);
        addPageMessage(respage.getString("String_Node_Str"));
        session.setAttribute("String_Node_Str","String_Node_Str");
        if (pwdChangeRequired == 1) {
          request.setAttribute("String_Node_Str","String_Node_Str");
          addPageMessage(respage.getString("String_Node_Str"));
        }
 else {
          request.setAttribute("String_Node_Str","String_Node_Str");
          addPageMessage(respage.getString("String_Node_Str") + "String_Node_Str" + respage.getString("String_Node_Str"));
        }
        forwardPage(Page.RESET_PASSWORD);
      }
    }
    if (currentStudy == null) {
      forwardPage(Page.MENU);
      return;
    }
    if (ub.getNumVisitsToMainMenu() <= 1) {
      if (ub.getLastVisitDate() != null) {
        addPageMessage(respage.getString("String_Node_Str") + "String_Node_Str" + ub.getFirstName()+ "String_Node_Str"+ ub.getLastName()+ "String_Node_Str"+ respage.getString("String_Node_Str")+ "String_Node_Str"+ local_df.format(ub.getLastVisitDate())+ "String_Node_Str");
      }
 else {
        addPageMessage(respage.getString("String_Node_Str") + "String_Node_Str" + ub.getFirstName()+ "String_Node_Str"+ ub.getLastName()+ "String_Node_Str");
      }
      if (currentStudy.getStatus().isLocked()) {
        addPageMessage(respage.getString("String_Node_Str"));
      }
 else       if (currentStudy.getStatus().isFrozen()) {
        addPageMessage(respage.getString("String_Node_Str"));
      }
    }
    Integer assignedDiscrepancies=getDiscrepancyNoteDAO().getViewNotesCountWithFilter(ub.getId(),currentStudy.getId());
    request.setAttribute("String_Node_Str",assignedDiscrepancies == null ? 0 : assignedDiscrepancies);
    int parentStudyId=currentStudy.getParentStudyId() > 0 ? currentStudy.getParentStudyId() : currentStudy.getId();
    StudyParameterValueDAO spvdao=new StudyParameterValueDAO(sm.getDataSource());
    StudyParameterValueBean parentSPV=spvdao.findByHandleAndStudy(parentStudyId,"String_Node_Str");
    currentStudy.getStudyParameterConfig().setSubjectIdGeneration(parentSPV.getValue());
    String idSetting=parentSPV.getValue();
    if (idSetting.equals("String_Node_Str") || idSetting.equals("String_Node_Str")) {
      request.setAttribute("String_Node_Str",resword.getString("String_Node_Str"));
      fp.addPresetValue("String_Node_Str",resword.getString("String_Node_Str"));
    }
    setPresetValues(fp.getPresetValues());
    if (currentRole.isInvestigator() || currentRole.isResearchAssistant() || currentRole.isResearchAssistant2()) {
      setupListStudySubjectTable();
    }
    if (currentRole.isMonitor()) {
      setupSubjectSDVTable();
    }
 else     if (currentRole.isCoordinator() || currentRole.isDirector()) {
      if (currentStudy.getStatus().isPending()) {
        response.sendRedirect(request.getContextPath() + Page.MANAGE_STUDY_MODULE.getFileName());
        return;
      }
      setupStudySiteStatisticsTable();
      setupSubjectEventStatusStatisticsTable();
      setupStudySubjectStatusStatisticsTable();
      if (currentStudy.getParentStudyId() == 0) {
        setupStudyStatisticsTable();
      }
    }
    forwardPage(Page.MENU);
  }
 else {
    studies=(ArrayList)sdao.findAllByUser(ub.getName());
    request.setAttribute("String_Node_Str",studies);
    session.setAttribute("String_Node_Str",ub);
    forwardPage(Page.MENU);
  }
}

Fixed version (ground truth):
@Override public void processRequest() throws Exception {
  FormProcessor fp=new FormProcessor(request);
  ub.incNumVisitsToMainMenu();
  session.setAttribute(USER_BEAN_NAME,ub);
  request.setAttribute("String_Node_Str",true);
  request.setAttribute("String_Node_Str",false);
  if (ub == null || ub.getId() == 0) {
    forwardPage(Page.MENU,false);
    return;
  }
  UserAccountDAO udao=new UserAccountDAO(sm.getDataSource());
  UserAccountBean ub1=(UserAccountBean)udao.findByPK(ub.getId());
  ub1.setLastVisitDate(new Date(System.currentTimeMillis()));
  ub1.setOwner(ub1);
  ub1.setUpdater(ub1);
  udao.update(ub1);
  if (currentStudy != null) {
    request.setAttribute("String_Node_Str",currentStudy.getId());
    request.setAttribute("String_Node_Str",super.getEventDefinitionsByCurrentStudy());
    request.setAttribute("String_Node_Str",super.getStudyGroupClassesByCurrentStudy());
  }
  logger.info("String_Node_Str" + ub.isLdapUser());
  if (currentStudy == null) {
    forwardPage(Page.MENU);
    return;
  }
  if (ub.getNumVisitsToMainMenu() <= 1) {
    if (ub.getLastVisitDate() != null) {
      addPageMessage(respage.getString("String_Node_Str") + "String_Node_Str" + ub.getFirstName()+ "String_Node_Str"+ ub.getLastName()+ "String_Node_Str"+ respage.getString("String_Node_Str")+ "String_Node_Str"+ local_df.format(ub.getLastVisitDate())+ "String_Node_Str");
    }
 else {
      addPageMessage(respage.getString("String_Node_Str") + "String_Node_Str" + ub.getFirstName()+ "String_Node_Str"+ ub.getLastName()+ "String_Node_Str");
    }
    if (currentStudy.getStatus().isLocked()) {
      addPageMessage(respage.getString("String_Node_Str"));
    }
 else     if (currentStudy.getStatus().isFrozen()) {
      addPageMessage(respage.getString("String_Node_Str"));
    }
  }
  Integer assignedDiscrepancies=getDiscrepancyNoteDAO().getViewNotesCountWithFilter(ub.getId(),currentStudy.getId());
  request.setAttribute("String_Node_Str",assignedDiscrepancies == null ? 0 : assignedDiscrepancies);
  int parentStudyId=currentStudy.getParentStudyId() > 0 ? currentStudy.getParentStudyId() : currentStudy.getId();
  StudyParameterValueDAO spvdao=new StudyParameterValueDAO(sm.getDataSource());
  StudyParameterValueBean parentSPV=spvdao.findByHandleAndStudy(parentStudyId,"String_Node_Str");
  currentStudy.getStudyParameterConfig().setSubjectIdGeneration(parentSPV.getValue());
  String idSetting=parentSPV.getValue();
  if (idSetting.equals("String_Node_Str") || idSetting.equals("String_Node_Str")) {
    request.setAttribute("String_Node_Str",resword.getString("String_Node_Str"));
    fp.addPresetValue("String_Node_Str",resword.getString("String_Node_Str"));
  }
  setPresetValues(fp.getPresetValues());
  if (currentRole.isInvestigator() || currentRole.isResearchAssistant() || currentRole.isResearchAssistant2()) {
    setupListStudySubjectTable();
  }
  if (currentRole.isMonitor()) {
    setupSubjectSDVTable();
  }
 else   if (currentRole.isCoordinator() || currentRole.isDirector()) {
    if (currentStudy.getStatus().isPending()) {
      response.sendRedirect(request.getContextPath() + Page.MANAGE_STUDY_MODULE.getFileName());
      return;
    }
    setupStudySiteStatisticsTable();
    setupSubjectEventStatusStatisticsTable();
    setupStudySubjectStatusStatisticsTable();
    if (currentStudy.getParentStudyId() == 0) {
      setupStudyStatisticsTable();
    }
  }
  forwardPage(Page.MENU);
}