Program: 107483
Project: 107483
Buggy source:
@SuppressWarnings("String_Node_Str") private void processRequest(HttpServletRequest req,HttpServletResponse resp){
  try {
    Map<String,Object[]> params=new HashMap<String,Object[]>();
    params.putAll(req.getParameterMap());
    HttpSession session=req.getSession(false);
    String responseType=BaseCmd.RESPONSE_TYPE_XML;
    Object[] responseTypeParam=params.get("String_Node_Str");
    if (responseTypeParam != null) {
      responseType=(String)responseTypeParam[0];
    }
    Object[] commandObj=params.get("String_Node_Str");
    if (commandObj != null) {
      String command=(String)commandObj[0];
      if ("String_Node_Str".equalsIgnoreCase(command)) {
        if (session != null) {
          String userIdStr=(String)session.getAttribute("String_Node_Str");
          if (userIdStr != null) {
            _apiServer.logoutUser(Long.parseLong(userIdStr));
          }
          session.invalidate();
        }
        writeResponse(resp,getLogoutSuccessResponse(responseType),false,responseType);
        return;
      }
 else       if ("String_Node_Str".equalsIgnoreCase(command)) {
        if (session != null)         session.invalidate();
        session=req.getSession(true);
        String[] username=(String[])params.get("String_Node_Str");
        String[] password=(String[])params.get("String_Node_Str");
        String[] domainIdArr=(String[])params.get("String_Node_Str");
        if (domainIdArr == null) {
          domainIdArr=(String[])params.get("String_Node_Str");
        }
        String[] domainName=(String[])params.get("String_Node_Str");
        Long domainId=null;
        if ((domainIdArr != null) && (domainIdArr.length > 0)) {
          try {
            domainId=new Long(Long.parseLong(domainIdArr[0]));
          }
 catch (          NumberFormatException e) {
            s_logger.warn("String_Node_Str");
            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
          }
        }
        String domain=null;
        if (domainName != null) {
          domain=domainName[0];
          if (domain != null) {
            if (!domain.endsWith("String_Node_Str")) {
              domain+='/';
            }
            if (!domain.startsWith("String_Node_Str")) {
              domain="String_Node_Str" + domain;
            }
          }
        }
        if (username != null) {
          String pwd=((password == null) ? null : password[0]);
          List<Pair<String,Object>> sessionParams=_apiServer.loginUser(session,username[0],pwd,domainId,domain,params);
          if (sessionParams != null) {
            for (            Pair<String,Object> sessionParam : sessionParams) {
              session.setAttribute(sessionParam.first(),sessionParam.second());
            }
            String loginResponse=getLoginSuccessResponse(session,responseType);
            writeResponse(resp,loginResponse,false,responseType);
            return;
          }
 else {
            session.invalidate();
            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
            return;
          }
        }
      }
    }
    boolean isNew=((session == null) ? true : session.isNew());
    UserContext.registerContext(null,null,null,null,null,null,false);
    String userId=null;
    if (!isNew) {
      userId=(String)session.getAttribute(BaseCmd.Properties.USER_ID.getName());
      String account=(String)session.getAttribute(BaseCmd.Properties.ACCOUNT.getName());
      String domainId=(String)session.getAttribute(BaseCmd.Properties.DOMAIN_ID.getName());
      Object accountObj=session.getAttribute(BaseCmd.Properties.ACCOUNT_OBJ.getName());
      String sessionKey=(String)session.getAttribute(BaseCmd.Properties.SESSION_KEY.getName());
      String[] sessionKeyParam=(String[])params.get(BaseCmd.Properties.SESSION_KEY.getName());
      if ((sessionKeyParam == null) || (sessionKey == null) || !sessionKey.equals(sessionKeyParam[0])) {
        session.invalidate();
        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
      }
      if ((userId != null) && (account != null) && (accountObj != null)&& _apiServer.verifyUser(Long.valueOf(userId))) {
        String[] command=(String[])params.get("String_Node_Str");
        if (command == null) {
          s_logger.info("String_Node_Str");
          resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
          return;
        }
        UserContext.updateContext(Long.valueOf(userId),accountObj,account,((Account)accountObj).getId(),Long.valueOf(domainId),session.getId());
      }
 else {
        session.invalidate();
        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
        return;
      }
    }
    if (_apiServer.verifyRequest(params,userId)) {
      try {
        String response=_apiServer.handleRequest(params,false,responseType);
        writeResponse(resp,response != null ? response : "String_Node_Str",false,responseType);
      }
 catch (      ServerApiException se) {
        resp.sendError(se.getErrorCode(),se.getDescription());
      }
    }
 else {
      if (session != null) {
        session.invalidate();
      }
      resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
    }
  }
 catch (  IOException ioex) {
    if (s_logger.isTraceEnabled()) {
      s_logger.trace("String_Node_Str" + ioex);
    }
  }
catch (  Exception ex) {
    s_logger.error("String_Node_Str",ex);
  }
 finally {
    UserContext.unregisterContext();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void processRequest(HttpServletRequest req,HttpServletResponse resp){
  try {
    Map<String,Object[]> params=new HashMap<String,Object[]>();
    params.putAll(req.getParameterMap());
    HttpSession session=req.getSession(false);
    String responseType=BaseCmd.RESPONSE_TYPE_XML;
    Object[] responseTypeParam=params.get("String_Node_Str");
    if (responseTypeParam != null) {
      responseType=(String)responseTypeParam[0];
    }
    Object[] commandObj=params.get("String_Node_Str");
    if (commandObj != null) {
      String command=(String)commandObj[0];
      if ("String_Node_Str".equalsIgnoreCase(command)) {
        if (session != null) {
          String userIdStr=(String)session.getAttribute("String_Node_Str");
          if (userIdStr != null) {
            _apiServer.logoutUser(Long.parseLong(userIdStr));
          }
          session.invalidate();
        }
        writeResponse(resp,getLogoutSuccessResponse(responseType),false,responseType);
        return;
      }
 else       if ("String_Node_Str".equalsIgnoreCase(command)) {
        if (session != null)         session.invalidate();
        session=req.getSession(true);
        String[] username=(String[])params.get("String_Node_Str");
        String[] password=(String[])params.get("String_Node_Str");
        String[] domainIdArr=(String[])params.get("String_Node_Str");
        if (domainIdArr == null) {
          domainIdArr=(String[])params.get("String_Node_Str");
        }
        String[] domainName=(String[])params.get("String_Node_Str");
        Long domainId=null;
        if ((domainIdArr != null) && (domainIdArr.length > 0)) {
          try {
            domainId=new Long(Long.parseLong(domainIdArr[0]));
          }
 catch (          NumberFormatException e) {
            s_logger.warn("String_Node_Str");
            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
          }
        }
        String domain=null;
        if (domainName != null) {
          domain=domainName[0];
          if (domain != null) {
            if (!domain.endsWith("String_Node_Str")) {
              domain+='/';
            }
            if (!domain.startsWith("String_Node_Str")) {
              domain="String_Node_Str" + domain;
            }
          }
        }
        if (username != null) {
          String pwd=((password == null) ? null : password[0]);
          List<Pair<String,Object>> sessionParams=_apiServer.loginUser(session,username[0],pwd,domainId,domain,params);
          if (sessionParams != null) {
            for (            Pair<String,Object> sessionParam : sessionParams) {
              session.setAttribute(sessionParam.first(),sessionParam.second());
            }
            String loginResponse=getLoginSuccessResponse(session,responseType);
            writeResponse(resp,loginResponse,false,responseType);
            return;
          }
 else {
            session.invalidate();
            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
            return;
          }
        }
      }
    }
    boolean isNew=((session == null) ? true : session.isNew());
    UserContext.registerContext(null,null,null,null,null,null,false);
    String userId=null;
    if (!isNew) {
      userId=(String)session.getAttribute("String_Node_Str");
      String account=(String)session.getAttribute("String_Node_Str");
      String domainId=(String)session.getAttribute("String_Node_Str");
      Object accountObj=session.getAttribute("String_Node_Str");
      String sessionKey=(String)session.getAttribute("String_Node_Str");
      String[] sessionKeyParam=(String[])params.get("String_Node_Str");
      if ((sessionKeyParam == null) || (sessionKey == null) || !sessionKey.equals(sessionKeyParam[0])) {
        session.invalidate();
        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
      }
      if ((userId != null) && (account != null) && (accountObj != null)&& _apiServer.verifyUser(Long.valueOf(userId))) {
        String[] command=(String[])params.get("String_Node_Str");
        if (command == null) {
          s_logger.info("String_Node_Str");
          resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
          return;
        }
        UserContext.updateContext(Long.valueOf(userId),accountObj,account,((Account)accountObj).getId(),Long.valueOf(domainId),session.getId());
      }
 else {
        session.invalidate();
        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
        return;
      }
    }
    if (_apiServer.verifyRequest(params,userId)) {
      try {
        String response=_apiServer.handleRequest(params,false,responseType);
        writeResponse(resp,response != null ? response : "String_Node_Str",false,responseType);
      }
 catch (      ServerApiException se) {
        resp.sendError(se.getErrorCode(),se.getDescription());
      }
    }
 else {
      if (session != null) {
        session.invalidate();
      }
      resp.sendError(HttpServletResponse.SC_UNAUTHORIZED,"String_Node_Str");
    }
  }
 catch (  IOException ioex) {
    if (s_logger.isTraceEnabled()) {
      s_logger.trace("String_Node_Str" + ioex);
    }
  }
catch (  Exception ex) {
    s_logger.error("String_Node_Str",ex);
  }
 finally {
    UserContext.unregisterContext();
  }
}