Program: 85429
Project: 85429
Buggy source:
public ILink save(IRequestCycle cycle) throws UserExistsException {
  log.debug("String_Node_Str");
  HttpServletRequest request=getRequest();
  IValidationDelegate delegate=getDelegate();
  if (!StringUtils.equals(getUser().getPassword(),getUser().getConfirmPassword())) {
    addError(delegate,"String_Node_Str",getMessages().format("String_Node_Str",getText("String_Node_Str"),getText("String_Node_Str")),ValidationConstraint.CONSISTENCY);
  }
  if (delegate.getHasErrors()) {
    return null;
  }
  String password=getUser().getPassword();
  String originalPassword=getRequest().getParameter("String_Node_Str");
  Boolean encrypt=(Boolean)getConfiguration().get(Constants.ENCRYPT_PASSWORD);
  boolean doEncrypt=(encrypt != null) && encrypt.booleanValue();
  if (doEncrypt && (StringUtils.equals(getRequest().getParameter("String_Node_Str"),"String_Node_Str") || !StringUtils.equals("String_Node_Str" + password,originalPassword)) || ("String_Node_Str".equals(request.getParameter(("String_Node_Str"))))) {
    String algorithm=(String)getConfiguration().get(Constants.ENC_ALGORITHM);
    if (algorithm == null) {
      log.debug("String_Node_Str");
      algorithm="String_Node_Str";
    }
    getUser().setPassword(StringUtil.encodePassword(password,algorithm));
  }
  boolean fromList=StringUtils.equals(getFrom(),"String_Node_Str");
  String[] userRoles;
  if (fromList) {
    userRoles=getRequest().getParameterValues("String_Node_Str");
  }
 else {
    userRoles=getRequest().getParameterValues("String_Node_Str");
  }
  User user=getUser();
  UserManager userManager=getUserManager();
  user.getRoles().clear();
  for (int i=0; (userRoles != null) && (i < userRoles.length); i++) {
    String roleName=userRoles[i];
    user.addRole(getRoleManager().getRole(roleName));
  }
  Integer originalVersion=user.getVersion();
  try {
    userManager.saveUser(user);
  }
 catch (  UserExistsException e) {
    log.warn(e.getMessage());
    addError(delegate,"String_Node_Str",getMessages().format("String_Node_Str",user.getUsername(),user.getEmail()),ValidationConstraint.CONSISTENCY);
    getUser().setPassword(user.getConfirmPassword());
    getUser().setVersion(originalVersion);
    return null;
  }
  if (!fromList && user.getUsername().equals(getRequest().getRemoteUser())) {
    MainMenu nextPage=(MainMenu)cycle.getPage("String_Node_Str");
    nextPage.setMessage(getText("String_Node_Str",user.getFullName()));
    return getEngineService().getLink(false,nextPage.getPageName());
  }
 else {
    if ("String_Node_Str".equals(request.getParameter(("String_Node_Str")))) {
      sendNewUserEmail(request,user);
      UserList nextPage=(UserList)cycle.getPage("String_Node_Str");
      nextPage.setMessage(getText("String_Node_Str",user.getFullName()));
      return getEngineService().getLink(false,nextPage.getPageName());
    }
 else {
      setMessage(getText("String_Node_Str",user.getFullName()));
      return null;
    }
  }
}

Fixed version (ground truth):
public ILink save(IRequestCycle cycle) throws UserExistsException {
  log.debug("String_Node_Str");
  HttpServletRequest request=getRequest();
  IValidationDelegate delegate=getDelegate();
  if (!StringUtils.equals(getUser().getPassword(),getUser().getConfirmPassword())) {
    addError("String_Node_Str",getMessages().format("String_Node_Str",getText("String_Node_Str"),getText("String_Node_Str")),ValidationConstraint.CONSISTENCY);
  }
  if (delegate.getHasErrors()) {
    return null;
  }
  String password=getUser().getPassword();
  String originalPassword=getRequest().getParameter("String_Node_Str");
  Boolean encrypt=(Boolean)getConfiguration().get(Constants.ENCRYPT_PASSWORD);
  boolean doEncrypt=(encrypt != null) && encrypt;
  if (doEncrypt && (StringUtils.equals(getRequest().getParameter("String_Node_Str"),"String_Node_Str") || !StringUtils.equals("String_Node_Str" + password,originalPassword)) || ("String_Node_Str".equals(request.getParameter(("String_Node_Str"))))) {
    String algorithm=(String)getConfiguration().get(Constants.ENC_ALGORITHM);
    if (algorithm == null) {
      log.debug("String_Node_Str");
      algorithm="String_Node_Str";
    }
    getUser().setPassword(StringUtil.encodePassword(password,algorithm));
  }
  boolean fromList=StringUtils.equals(getFrom(),"String_Node_Str");
  String[] userRoles;
  if (fromList) {
    userRoles=getRequest().getParameterValues("String_Node_Str");
  }
 else {
    userRoles=getRequest().getParameterValues("String_Node_Str");
  }
  User user=getUser();
  UserManager userManager=getUserManager();
  user.getRoles().clear();
  for (int i=0; (userRoles != null) && (i < userRoles.length); i++) {
    String roleName=userRoles[i];
    user.addRole(getRoleManager().getRole(roleName));
  }
  Integer originalVersion=user.getVersion();
  try {
    userManager.saveUser(user);
  }
 catch (  UserExistsException e) {
    log.warn(e.getMessage());
    addError("String_Node_Str",getMessages().format("String_Node_Str",user.getUsername(),user.getEmail()),ValidationConstraint.CONSISTENCY);
    getUser().setPassword(user.getConfirmPassword());
    getUser().setVersion(originalVersion);
    return null;
  }
  if (!fromList && user.getUsername().equals(getRequest().getRemoteUser())) {
    MainMenu nextPage=(MainMenu)cycle.getPage("String_Node_Str");
    nextPage.setMessage(getText("String_Node_Str",user.getFullName()));
    return getEngineService().getLink(false,nextPage.getPageName());
  }
 else {
    if ("String_Node_Str".equals(request.getParameter(("String_Node_Str")))) {
      sendNewUserEmail(request,user);
      UserList nextPage=(UserList)cycle.getPage("String_Node_Str");
      nextPage.setMessage(getText("String_Node_Str",user.getFullName()));
      return getEngineService().getLink(false,nextPage.getPageName());
    }
 else {
      setMessage(getText("String_Node_Str",user.getFullName()));
      return null;
    }
  }
}