Program: 85507
Project: 85507
Buggy source:
public ActionForward save(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  ActionMessages errors=new ActionMessages();
  ActionMessages messages=new ActionMessages();
  HttpSession session=request.getSession();
  UserFormEx userForm=(UserFormEx)form;
  String password=userForm.getPassword();
  User user=new User();
  BeanUtils.copyProperties(user,userForm);
  if (StringUtils.equals(request.getParameter("String_Node_Str"),"String_Node_Str")) {
    String algorithm=(String)getConfiguration().get(Constants.ENC_ALGORITHM);
    if (algorithm == null) {
      log.debug("String_Node_Str");
      algorithm="String_Node_Str";
    }
    user.setPassword(StringUtil.encodePassword(password,algorithm));
  }
  UserManager mgr=(UserManager)getBean("String_Node_Str");
  try {
    user=(User)mgr.saveUser(user);
    setupRoles(user,request);
  }
 catch (  Exception e) {
    if ((e.getMessage() != null) && (e.getMessage().indexOf("String_Node_Str") != -1)) {
      log.warn("String_Node_Str" + e.getMessage());
      errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername(),userForm.getEmail()));
      saveErrors(request,errors);
      return mapping.findForward("String_Node_Str");
    }
    e.printStackTrace();
    errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str"));
    while (e != null) {
      errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",e.getMessage()));
      e=(Exception)e.getCause();
    }
    saveErrors(request,errors);
    return mapping.findForward("String_Node_Str");
  }
  if (!StringUtils.equals(request.getParameter("String_Node_Str"),"String_Node_Str")) {
    session.setAttribute(Constants.USER_KEY,userForm);
    if ((RequestUtil.getCookie(request,Constants.LOGIN_COOKIE) != null) && (session.getAttribute("String_Node_Str") == null)) {
      mgr.removeLoginCookies(userForm.getUsername());
      String autoLogin=mgr.createLoginCookie(userForm.getUsername());
      RequestUtil.setCookie(response,Constants.LOGIN_COOKIE,autoLogin,request.getContextPath());
    }
    messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str"));
    saveMessages(request,messages);
    return mapping.findForward("String_Node_Str");
  }
 else {
    if (StringUtils.isEmpty(userForm.getId())) {
      messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername()));
      session.setAttribute(Globals.MESSAGE_KEY,messages);
      sendNewUserEmail(request,userForm);
      return mapping.findForward("String_Node_Str");
    }
 else {
      messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername()));
      saveMessages(request,messages);
      return mapping.findForward("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public ActionForward save(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  ActionMessages errors=new ActionMessages();
  ActionMessages messages=new ActionMessages();
  HttpSession session=request.getSession();
  UserFormEx userForm=(UserFormEx)form;
  String password=userForm.getPassword();
  User user=new User();
  BeanUtils.copyProperties(user,userForm);
  if (StringUtils.equals(request.getParameter("String_Node_Str"),"String_Node_Str")) {
    String algorithm=(String)getConfiguration().get(Constants.ENC_ALGORITHM);
    if (algorithm == null) {
      log.debug("String_Node_Str");
      algorithm="String_Node_Str";
    }
    user.setPassword(StringUtil.encodePassword(password,algorithm));
  }
  UserManager mgr=(UserManager)getBean("String_Node_Str");
  try {
    user=(User)mgr.saveUser(user);
    setupRoles(user,request);
  }
 catch (  Exception e) {
    if ((e.getMessage() != null) && (e.getMessage().indexOf("String_Node_Str") != -1)) {
      log.warn("String_Node_Str" + e.getMessage());
      errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername(),userForm.getEmail()));
      saveErrors(request,errors);
      return mapping.findForward("String_Node_Str");
    }
    e.printStackTrace();
    errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str"));
    while (e != null) {
      errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",e.getMessage()));
      e=(Exception)e.getCause();
    }
    saveErrors(request,errors);
    return mapping.findForward("String_Node_Str");
  }
  if (!StringUtils.equals(request.getParameter("String_Node_Str"),"String_Node_Str")) {
    session.setAttribute(Constants.USER_KEY,user);
    if ((RequestUtil.getCookie(request,Constants.LOGIN_COOKIE) != null) && (session.getAttribute("String_Node_Str") == null)) {
      mgr.removeLoginCookies(userForm.getUsername());
      String autoLogin=mgr.createLoginCookie(userForm.getUsername());
      RequestUtil.setCookie(response,Constants.LOGIN_COOKIE,autoLogin,request.getContextPath());
    }
    messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str"));
    saveMessages(request,messages);
    return mapping.findForward("String_Node_Str");
  }
 else {
    if (StringUtils.isEmpty(userForm.getId())) {
      messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername()));
      session.setAttribute(Globals.MESSAGE_KEY,messages);
      sendNewUserEmail(request,userForm);
      return mapping.findForward("String_Node_Str");
    }
 else {
      messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("String_Node_Str",userForm.getUsername()));
      saveMessages(request,messages);
      return mapping.findForward("String_Node_Str");
    }
  }
}