Program: 115328
Project: 115328
Buggy source:
/** 
 * @param request
 * @param response
 */
private void confirmPassword() throws Exception {
  Validator v=new Validator(request);
  FormProcessor fp=new FormProcessor(request);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  v.addValidation("String_Node_Str",Validator.IS_A_EMAIL);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  errors=v.validate();
  UserAccountBean ubForm=new UserAccountBean();
  ubForm.setName(fp.getString("String_Node_Str"));
  ubForm.setEmail(fp.getString("String_Node_Str"));
  ubForm.setPasswdChallengeQuestion(fp.getString("String_Node_Str"));
  ubForm.setPasswdChallengeAnswer(fp.getString("String_Node_Str"));
  sm=new SessionManager(null,ubForm.getName(),SpringServletAccess.getApplicationContext(context));
  UserAccountDAO uDAO=new UserAccountDAO(sm.getDataSource());
  UserAccountBean ubDB=(UserAccountBean)uDAO.findByUserName(ubForm.getName());
  UserAccountBean updater=ubDB;
  request.setAttribute("String_Node_Str",ubForm);
  if (!errors.isEmpty()) {
    logger.info("String_Node_Str");
    request.setAttribute("String_Node_Str",errors);
    forwardPage(Page.REQUEST_PWD);
  }
 else {
    logger.info("String_Node_Str");
    if (ubDB.getEmail() != null && ubDB.getEmail().equalsIgnoreCase(ubForm.getEmail())) {
      logger.info("String_Node_Str" + ubDB.getPasswdChallengeQuestion());
      logger.info("String_Node_Str" + ubForm.getPasswdChallengeQuestion());
      logger.info("String_Node_Str" + ubDB.getPasswdChallengeAnswer());
      logger.info("String_Node_Str" + ubForm.getPasswdChallengeAnswer());
      if (ubDB.getPasswdChallengeQuestion().equals(ubForm.getPasswdChallengeQuestion()) && ubDB.getPasswdChallengeAnswer().equalsIgnoreCase(ubForm.getPasswdChallengeAnswer())) {
        SecurityManager sm=((SecurityManager)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str"));
        String newPass=sm.genPassword();
        OpenClinicaJdbcService ocService=((OpenClinicaJdbcService)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str"));
        String newDigestPass=sm.encrytPassword(newPass,ocService.loadUserByUsername(ubForm.getName()));
        ubDB.setPasswd(newDigestPass);
        Calendar cal=Calendar.getInstance();
        ubDB.setPasswdTimestamp(new Date());
        ubDB.setUpdater(updater);
        ubDB.setLastVisitDate(new Date());
        logger.info("String_Node_Str" + ubDB.getId() + ubDB.getName()+ ubDB.getActiveStudyId());
        uDAO.update(ubDB);
        sendPassword(newPass,ubDB);
      }
 else {
        addPageMessage(respage.getString("String_Node_Str"));
        forwardPage(Page.REQUEST_PWD);
      }
    }
 else {
      addPageMessage(respage.getString("String_Node_Str"));
      forwardPage(Page.REQUEST_PWD);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param request
 * @param response
 */
private void confirmPassword() throws Exception {
  Validator v=new Validator(request);
  FormProcessor fp=new FormProcessor(request);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  v.addValidation("String_Node_Str",Validator.IS_A_EMAIL);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  v.addValidation("String_Node_Str",Validator.NO_BLANKS);
  errors=v.validate();
  UserAccountBean ubForm=new UserAccountBean();
  ubForm.setName(fp.getString("String_Node_Str"));
  ubForm.setEmail(fp.getString("String_Node_Str"));
  ubForm.setPasswdChallengeQuestion(fp.getString("String_Node_Str"));
  ubForm.setPasswdChallengeAnswer(fp.getString("String_Node_Str"));
  sm=new SessionManager(null,ubForm.getName(),SpringServletAccess.getApplicationContext(context));
  UserAccountDAO uDAO=new UserAccountDAO(sm.getDataSource());
  UserAccountBean ubDB=(UserAccountBean)uDAO.findByUserName(ubForm.getName());
  UserAccountBean updater=ubDB;
  request.setAttribute("String_Node_Str",ubForm);
  if (!errors.isEmpty()) {
    logger.info("String_Node_Str");
    request.setAttribute("String_Node_Str",errors);
    forwardPage(Page.REQUEST_PWD);
  }
 else {
    logger.info("String_Node_Str");
    if (ubDB.getEmail() != null && ubDB.getEmail().equalsIgnoreCase(ubForm.getEmail())) {
      logger.info("String_Node_Str" + ubDB.getPasswdChallengeQuestion());
      logger.info("String_Node_Str" + ubForm.getPasswdChallengeQuestion());
      logger.info("String_Node_Str" + ubDB.getPasswdChallengeAnswer());
      logger.info("String_Node_Str" + ubForm.getPasswdChallengeAnswer());
      if (ubDB.getPasswdChallengeQuestion().equals(ubForm.getPasswdChallengeQuestion()) && ubDB.getPasswdChallengeAnswer().equalsIgnoreCase(ubForm.getPasswdChallengeAnswer())) {
        SecurityManager sm=((SecurityManager)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str"));
        String newPass=sm.genPassword();
        OpenClinicaJdbcService ocService=((OpenClinicaJdbcService)SpringServletAccess.getApplicationContext(context).getBean("String_Node_Str"));
        String newDigestPass=sm.encrytPassword(newPass,ocService.loadUserByUsername(ubForm.getName()));
        System.out.println("String_Node_Str" + newDigestPass + "String_Node_Str");
        ubDB.setPasswd(newDigestPass);
        Calendar cal=Calendar.getInstance();
        ubDB.setPasswdTimestamp(null);
        ubDB.setUpdater(updater);
        ubDB.setLastVisitDate(new Date());
        logger.info("String_Node_Str" + ubDB.getId() + ubDB.getName()+ ubDB.getActiveStudyId());
        uDAO.update(ubDB);
        sendPassword(newPass,ubDB);
      }
 else {
        addPageMessage(respage.getString("String_Node_Str"));
        forwardPage(Page.REQUEST_PWD);
      }
    }
 else {
      addPageMessage(respage.getString("String_Node_Str"));
      forwardPage(Page.REQUEST_PWD);
    }
  }
}