/* good2() reverses the bodies in the if statement */
  private void good2(HttpServletRequest request, HttpServletResponse response) throws Throwable {
    if (IO.static_returns_t()) {
      Logger tcLog = Logger.getLogger("cwe_testcases_logger");
      if (request.getParameter("username") == null) {
        return;
      }
      String username = request.getParameter("username");
      if (username.matches("[a-zA-Z0-9]*")) {
        HttpSession session = request.getSession(true);
        /* FIX: logged message does not contain session id */
        tcLog.log(Level.FINEST, "Username: "******" Session ID:" + session.getId());
      } else {
        response.getWriter().println("Invalid characters");
      }
    } else {
      /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */

      Logger tcLog = Logger.getLogger("cwe_testcases_logger");
      if (request.getParameter("username") == null) {
        return;
      }

      String username = request.getParameter("username");

      if (username.matches("[a-zA-Z0-9]*")) {
        HttpSession session = request.getSession(true);
        /* FLAW: leak session ID to debug log */
        tcLog.log(Level.FINEST, "Username: "******" Session ID:" + session.getId());
      } else {
        response.getWriter().println("Invalid characters");
      }
    }
  }
 public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable {
   if (IO.STATIC_FINAL_FIVE == 5) {
     if (request.getParameter("username") == null) {
       return;
     }
     String username = request.getParameter("username");
     if (username.matches("[a-zA-Z0-9]*")) {
       HttpSession session = request.getSession(true);
       /* FLAW: Expose the session ID to server log */
       log("Username: "******" Session ID:" + session.getId());
     } else {
       response.getWriter().println("Invalid characters");
     }
   }
 }