Program: 115002
Project: 115002
Buggy source:
public UserAccountBean createUser(HttpServletRequest request,HashMap<String,String> map) throws Exception {
  logger.info("String_Node_Str");
  UserAccountBean uBean=null;
  ZonedDateTime java8DateTime=ZonedDateTime.now();
  String username=map.get("String_Node_Str");
  String fName=map.get("String_Node_Str");
  String lName=map.get("String_Node_Str");
  String institution=map.get("String_Node_Str");
  String email=map.get("String_Node_Str");
  String roleName=map.get("String_Node_Str");
  String userType=map.get("String_Node_Str");
  String apiKey=map.get("String_Node_Str");
  apiKey=apiKey == null ? "String_Node_Str" : apiKey;
  String authorizeSoap=map.get("String_Node_Str");
  String userUuid=map.get("String_Node_Str");
  request.setAttribute("String_Node_Str",username);
  request.setAttribute("String_Node_Str",fName);
  request.setAttribute("String_Node_Str",lName);
  request.setAttribute("String_Node_Str",institution);
  request.setAttribute("String_Node_Str",email);
  request.setAttribute("String_Node_Str",roleName);
  UserAccountBean ownerUserAccount=(UserAccountBean)request.getSession().getAttribute("String_Node_Str");
  if (!ownerUserAccount.isActive() && (!ownerUserAccount.isTechAdmin() || !ownerUserAccount.isSysAdmin())) {
    logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    return uBean;
  }
  String password="String_Node_Str";
  String passwordHash="String_Node_Str";
  Locale locale=new Locale("String_Node_Str");
  request.getSession().setAttribute(LocaleResolver.getLocaleSessionAttributeName(),locale);
  ResourceBundleProvider.updateLocale(locale);
  ResourceBundle resterm=org.akaza.openclinica.i18n.util.ResourceBundleProvider.getTermsBundle();
  Map<Integer,String> roleMap=buildRoleMap(false,resterm);
  boolean found=false;
  Role role=null;
  for (  Map.Entry<Integer,String> entry : roleMap.entrySet()) {
    if (roleName.equalsIgnoreCase(entry.getValue())) {
      Integer key=entry.getKey();
      role=Role.get(key);
      found=true;
      break;
    }
  }
  if (!found) {
    logger.error("String_Node_Str");
    return uBean;
  }
  found=false;
  UserType uType=null;
  ArrayList<UserType> types=UserType.toArrayList();
  types.remove(UserType.INVALID);
  for (  UserType type : types) {
    if (userType.equalsIgnoreCase(type.getName())) {
      uType=UserType.get(type.getId());
      found=true;
      break;
    }
  }
  if (!found) {
    logger.error("String_Node_Str");
    return uBean;
  }
  uBean=buildUserAccount(username,fName,lName,password,institution,ownerUserAccount,email,passwordHash,Boolean.valueOf(authorizeSoap),role,uType);
  uBean.setApiKey(apiKey);
  uBean.setUserUuid(userUuid);
  UserAccountBean uaBean=getUserAccount(uBean.getName());
  if (!uaBean.isActive()) {
    createUserAccount(uBean);
    uBean.setUpdater(uBean.getOwner());
    updateUserAccount(uBean);
    logger.info("String_Node_Str");
    uBean.setPasswd(password);
  }
  request.setAttribute("String_Node_Str",uBean);
  return uBean;
}

Fixed version (ground truth):
public UserAccountBean createUser(HttpServletRequest request,HashMap<String,String> map) throws Exception {
  logger.info("String_Node_Str");
  UserAccountBean uBean=null;
  ZonedDateTime java8DateTime=ZonedDateTime.now();
  String username=map.get("String_Node_Str");
  String fName=map.get("String_Node_Str");
  String lName=map.get("String_Node_Str");
  String institution=map.get("String_Node_Str");
  String email=map.get("String_Node_Str");
  String roleName=map.get("String_Node_Str");
  String userType=map.get("String_Node_Str");
  String apiKey=map.get("String_Node_Str");
  apiKey=apiKey == null ? "String_Node_Str" : apiKey;
  String authorizeSoap=map.get("String_Node_Str");
  String userUuid=map.get("String_Node_Str");
  request.setAttribute("String_Node_Str",username);
  request.setAttribute("String_Node_Str",fName);
  request.setAttribute("String_Node_Str",lName);
  request.setAttribute("String_Node_Str",institution);
  request.setAttribute("String_Node_Str",email);
  request.setAttribute("String_Node_Str",roleName);
  UserAccountBean ownerUserAccount=(UserAccountBean)request.getSession().getAttribute("String_Node_Str");
  if (!ownerUserAccount.isActive() && (!ownerUserAccount.isTechAdmin() || !ownerUserAccount.isSysAdmin())) {
    logger.info("String_Node_Str");
    System.out.println("String_Node_Str");
    return uBean;
  }
  String password="String_Node_Str";
  String passwordHash="String_Node_Str";
  Locale locale=new Locale("String_Node_Str");
  request.getSession().setAttribute(LocaleResolver.getLocaleSessionAttributeName(),locale);
  ResourceBundleProvider.updateLocale(locale);
  ResourceBundle resterm=org.akaza.openclinica.i18n.util.ResourceBundleProvider.getTermsBundle();
  Map<Integer,String> roleMap=buildRoleMap(false,resterm);
  boolean found=false;
  Role role=null;
  for (  Map.Entry<Integer,String> entry : roleMap.entrySet()) {
    if (roleName.equalsIgnoreCase(entry.getValue())) {
      Integer key=entry.getKey();
      role=Role.get(key);
      found=true;
      break;
    }
  }
  if (!found) {
    logger.error("String_Node_Str");
    return uBean;
  }
  UserType uType=null;
  ArrayList<UserType> types=UserType.toArrayList();
  types.remove(UserType.INVALID);
switch (userType) {
case "String_Node_Str":
    uType=UserType.SYSADMIN;
  break;
case "String_Node_Str":
uType=UserType.TECHADMIN;
break;
case "String_Node_Str":
uType=UserType.USER;
break;
default :
uType=UserType.INVALID;
break;
}
if (uType == UserType.INVALID) {
logger.error("String_Node_Str");
return uBean;
}
uBean=buildUserAccount(username,fName,lName,password,institution,ownerUserAccount,email,passwordHash,Boolean.valueOf(authorizeSoap),role,uType);
uBean.setApiKey(apiKey);
uBean.setUserUuid(userUuid);
UserAccountBean uaBean=getUserAccount(uBean.getName());
if (!uaBean.isActive()) {
createUserAccount(uBean);
uBean.setUpdater(uBean.getOwner());
updateUserAccount(uBean);
logger.info("String_Node_Str");
uBean.setPasswd(password);
}
request.setAttribute("String_Node_Str",uBean);
return uBean;
}