Program: 86035
Project: 86035
Buggy source:
public void logIn() throws ServletException, AccountNotFoundException, IOException {
  HttpServletRequest request=(HttpServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
  HttpSession session=(HttpSession)request.getSession();
  request.login(login,password);
  Account account=userManager.getAccount(login);
  if (!login.equals(account.getLogin())) {
    request.logout();
    throw new AccountNotFoundException(new Locale(account.getLanguage()),login);
  }
  session.setAttribute("String_Node_Str",account);
  Map<String,Workspace> administeredWorkspaces=new HashMap<String,Workspace>();
  for (  Workspace wks : userManager.getAdministratedWorkspaces()) {
    administeredWorkspaces.put(wks.getId(),wks);
  }
  session.setAttribute("String_Node_Str",administeredWorkspaces);
  Set<Workspace> regularWorkspaces=new HashSet<Workspace>();
  Workspace[] workspaces=userManager.getWorkspacesWhereCallerIsActive();
  regularWorkspaces.addAll(Arrays.asList(workspaces));
  regularWorkspaces.removeAll(administeredWorkspaces.values());
  session.setAttribute("String_Node_Str",regularWorkspaces);
  FacesContext fc=FacesContext.getCurrentInstance();
  ExternalContext ec=fc.getExternalContext();
  if (userManager.isCallerInRole("String_Node_Str")) {
    ec.redirect(request.getContextPath() + "String_Node_Str");
    session.setAttribute("String_Node_Str",true);
  }
 else {
    session.setAttribute("String_Node_Str",false);
    if (originURL != null && originURL.length() > 1)     ec.redirect(originURL);
 else     ec.redirect(request.getContextPath() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void logIn() throws ServletException, AccountNotFoundException, IOException {
  HttpServletRequest request=(HttpServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
  HttpSession session=(HttpSession)request.getSession();
  request.logout();
  request.login(login,password);
  Account account=userManager.getAccount(login);
  if (!login.equals(account.getLogin())) {
    request.logout();
    throw new AccountNotFoundException(new Locale(account.getLanguage()),login);
  }
  session.setAttribute("String_Node_Str",account);
  Map<String,Workspace> administeredWorkspaces=new HashMap<String,Workspace>();
  for (  Workspace wks : userManager.getAdministratedWorkspaces()) {
    administeredWorkspaces.put(wks.getId(),wks);
  }
  session.setAttribute("String_Node_Str",administeredWorkspaces);
  Set<Workspace> regularWorkspaces=new HashSet<Workspace>();
  Workspace[] workspaces=userManager.getWorkspacesWhereCallerIsActive();
  regularWorkspaces.addAll(Arrays.asList(workspaces));
  regularWorkspaces.removeAll(administeredWorkspaces.values());
  session.setAttribute("String_Node_Str",regularWorkspaces);
  FacesContext fc=FacesContext.getCurrentInstance();
  ExternalContext ec=fc.getExternalContext();
  if (userManager.isCallerInRole("String_Node_Str")) {
    ec.redirect(request.getContextPath() + "String_Node_Str");
    session.setAttribute("String_Node_Str",true);
  }
 else {
    session.setAttribute("String_Node_Str",false);
    if (originURL != null && originURL.length() > 1)     ec.redirect(originURL);
 else     ec.redirect(request.getContextPath() + "String_Node_Str");
  }
}