Program: 39085
Project: 39085
Buggy source:
public static UserDetails getUserDetails(HttpServletRequest httpRequest){
  log.debug("String_Node_Str");
  ApplicationConfigProvider.performSystemCheck();
  String authHeader=httpRequest.getHeader("String_Node_Str");
  Cookie[] requestCookies=httpRequest.getCookies();
  log.debug("String_Node_Str" + requestCookies);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  Map<String,String> cookieMap=new HashMap<String,String>();
  if (requestCookies != null) {
    for (    Cookie cookie : requestCookies) {
      cookieMap.put(cookie.getName(),cookie.getValue());
    }
  }
  log.debug("String_Node_Str" + cookieMap);
  String userName=null;
  String credential=null;
  try {
    String decodedAuthHeader=new String(Base64.getDecoder().decode(authHeader.split("String_Node_Str")[1]),"String_Node_Str");
    String[] authTokens=decodedAuthHeader.split("String_Node_Str");
    userName=authTokens[0];
    credential=authTokens[1];
    String grafanaUser=cookieMap.get("String_Node_Str");
    log.debug("String_Node_Str" + userName);
    log.debug("String_Node_Str" + grafanaUser);
    if (userName.equals(grafanaUser)) {
      log.debug("String_Node_Str");
      grafanaResponseCookies.putAll(cookieMap);
      log.debug("String_Node_Str" + grafanaResponseCookies);
      if ((grafanaResponseCookies.get("String_Node_Str") == null || grafanaResponseCookies.get("String_Node_Str").isEmpty()) && (grafanaResponseCookies.get("String_Node_Str") == null || grafanaResponseCookies.get("String_Node_Str").isEmpty())) {
        log.debug("String_Node_Str");
        Map<String,String> headers=new HashMap<String,String>();
        StringBuffer grafanaCookie=new StringBuffer();
        for (        Map.Entry<String,String> cookie : grafanaResponseCookies.entrySet()) {
          grafanaCookie.append(cookie.getKey()).append("String_Node_Str").append(cookie.getValue()).append("String_Node_Str");
        }
        headers.put("String_Node_Str",grafanaCookie.toString());
        String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
        grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
        String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
        grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
        log.debug("String_Node_Str" + grafanaResponseCookies);
      }
    }
 else {
      log.debug("String_Node_Str");
      List<NewCookie> cookies=getValidGrafanaSession(authTokens[0],authTokens[1]);
      log.debug("String_Node_Str" + cookies);
      StringBuffer grafanaCookie=new StringBuffer();
      for (      NewCookie cookie : cookies) {
        grafanaResponseCookies.put(cookie.getName(),cookie.getValue());
        grafanaCookie.append(cookie.getName()).append("String_Node_Str").append(cookie.getValue()).append("String_Node_Str");
      }
      Map<String,String> headers=new HashMap<String,String>();
      headers.put("String_Node_Str",grafanaCookie.toString());
      String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
      grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
      String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
      grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
      log.debug("String_Node_Str" + grafanaResponseCookies);
    }
    List<GrantedAuthority> mappedAuthorities=new ArrayList<GrantedAuthority>();
    String grafanaRole=grafanaResponseCookies.get("String_Node_Str");
    if (grafanaRole == null || grafanaRole.trim().length() == 0) {
      log.debug("String_Node_Str");
      mappedAuthorities.add(SpringAuthority.valueOf("String_Node_Str"));
    }
 else {
      mappedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaRole));
    }
    httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
    if (ApplicationConfigProvider.getInstance().isEnableNativeUsers()) {
      return new User(userName,credential,true,true,true,true,mappedAuthorities);
    }
 else {
      return new User(userName,"String_Node_Str",true,true,true,true,mappedAuthorities);
    }
  }
 catch (  Exception e) {
    log.error(e);
  }
  log.debug("String_Node_Str");
  return null;
}

Fixed version (ground truth):
public static UserDetails getUserDetails(HttpServletRequest httpRequest){
  log.debug("String_Node_Str");
  ApplicationConfigProvider.performSystemCheck();
  String authHeader=httpRequest.getHeader("String_Node_Str");
  Cookie[] requestCookies=httpRequest.getCookies();
  log.debug("String_Node_Str" + requestCookies);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  Map<String,String> cookieMap=new HashMap<String,String>();
  if (requestCookies != null) {
    for (    Cookie cookie : requestCookies) {
      cookieMap.put(cookie.getName(),cookie.getValue());
    }
  }
  log.debug("String_Node_Str" + cookieMap);
  String userName=null;
  String credential=null;
  try {
    String decodedAuthHeader=new String(Base64.getDecoder().decode(authHeader.split("String_Node_Str")[1]),"String_Node_Str");
    String[] authTokens=decodedAuthHeader.split("String_Node_Str");
    userName=authTokens[0];
    credential=authTokens[1];
    String grafanaUser=cookieMap.get("String_Node_Str");
    String grafanaSession=cookieMap.get("String_Node_Str");
    log.debug("String_Node_Str" + userName);
    log.debug("String_Node_Str" + grafanaUser);
    if (userName.equals(grafanaUser) && grafanaSession != null) {
      log.debug("String_Node_Str");
      grafanaResponseCookies.putAll(cookieMap);
      log.debug("String_Node_Str" + grafanaResponseCookies);
      if ((grafanaResponseCookies.get("String_Node_Str") == null || grafanaResponseCookies.get("String_Node_Str").isEmpty()) && (grafanaResponseCookies.get("String_Node_Str") == null || grafanaResponseCookies.get("String_Node_Str").isEmpty())) {
        log.debug("String_Node_Str");
        Map<String,String> headers=new HashMap<String,String>();
        StringBuffer grafanaCookie=new StringBuffer();
        for (        Map.Entry<String,String> cookie : grafanaResponseCookies.entrySet()) {
          grafanaCookie.append(cookie.getKey()).append("String_Node_Str").append(cookie.getValue()).append("String_Node_Str");
        }
        headers.put("String_Node_Str",grafanaCookie.toString());
        String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
        grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
        String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
        grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
        log.debug("String_Node_Str" + grafanaResponseCookies);
      }
    }
 else {
      log.debug("String_Node_Str");
      List<NewCookie> cookies=getValidGrafanaSession(authTokens[0],authTokens[1]);
      log.debug("String_Node_Str" + cookies);
      StringBuffer grafanaCookie=new StringBuffer();
      for (      NewCookie cookie : cookies) {
        grafanaResponseCookies.put(cookie.getName(),cookie.getValue());
        grafanaCookie.append(cookie.getName()).append("String_Node_Str").append(cookie.getValue()).append("String_Node_Str");
      }
      Map<String,String> headers=new HashMap<String,String>();
      headers.put("String_Node_Str",grafanaCookie.toString());
      String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
      grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
      String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
      grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
      log.debug("String_Node_Str" + grafanaResponseCookies);
    }
    List<GrantedAuthority> mappedAuthorities=new ArrayList<GrantedAuthority>();
    String grafanaRole=grafanaResponseCookies.get("String_Node_Str");
    if (grafanaRole == null || grafanaRole.trim().length() == 0) {
      log.debug("String_Node_Str");
      mappedAuthorities.add(SpringAuthority.valueOf("String_Node_Str"));
    }
 else {
      mappedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaRole));
    }
    httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
    if (ApplicationConfigProvider.getInstance().isEnableNativeUsers()) {
      return new User(userName,credential,true,true,true,true,mappedAuthorities);
    }
 else {
      return new User(userName,"String_Node_Str",true,true,true,true,mappedAuthorities);
    }
  }
 catch (  Exception e) {
    log.error(e);
  }
  log.debug("String_Node_Str");
  return null;
}