Program: 115275
Project: 115275
Buggy source:
@Override public void processRequest() throws Exception {
  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);
  request.setAttribute("String_Node_Str",currentStudy.getId());
  request.setAttribute("String_Node_Str",super.getEventDefinitionsByCurrentStudy());
  request.setAttribute("String_Node_Str",super.getStudyGroupClassesByCurrentStudy());
  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 (days > pwdExpireDay) {
      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);
    }
 else {
      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("String_Node_Str" + ub.getId() + "String_Node_Str",currentStudy);
      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",AUTO_LABEL);
      }
      if (currentRole.isInvestigator() || currentRole.isResearchAssistant()) {
        setupListStudySubjectTable();
      }
      if (currentRole.isMonitor()) {
        setupSubjectSDVTable();
      }
 else       if (currentRole.isCoordinator() || currentRole.isDirector()) {
        if (currentStudy.getStatus().isPending()) {
          response.sendRedirect(request.getContextPath() + Page.MANAGE_STUDY_MODULE);
          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);
    if (pwdChangeRequired == 1) {
    }
 else {
      forwardPage(Page.MENU);
    }
  }
}

Fixed version (ground truth):
@Override public void processRequest() throws Exception {
  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);
  request.setAttribute("String_Node_Str",currentStudy.getId());
  request.setAttribute("String_Node_Str",super.getEventDefinitionsByCurrentStudy());
  request.setAttribute("String_Node_Str",super.getStudyGroupClassesByCurrentStudy());
  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 (days > pwdExpireDay) {
      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);
    }
 else {
      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("String_Node_Str" + ub.getId() + "String_Node_Str",currentStudy);
      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"));
      }
      if (currentRole.isInvestigator() || currentRole.isResearchAssistant()) {
        setupListStudySubjectTable();
      }
      if (currentRole.isMonitor()) {
        setupSubjectSDVTable();
      }
 else       if (currentRole.isCoordinator() || currentRole.isDirector()) {
        if (currentStudy.getStatus().isPending()) {
          response.sendRedirect(request.getContextPath() + Page.MANAGE_STUDY_MODULE);
          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);
    if (pwdChangeRequired == 1) {
    }
 else {
      forwardPage(Page.MENU);
    }
  }
}