<commit_before>package demo;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * This class is the Logout handler.
 */
public class LogoutServlet extends HttpServlet {	

	private static final long serialVersionUID = -2226253641448684463L;

	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

		String name = LoginStuff.getUserName(request);
		if (name == null) {
			System.out.printf("Non-logged-in user got to LogoutServlet from %s%n", request.getRemoteAddr());
		}
		System.out.printf("Logging out user %s%n", name);
		
        request.getSession().removeAttribute(LoginStuff.LOGIN_FLAG);
        
        response.sendRedirect(".");
    }


}<commit_msg>Less verbose.<commit_after>package demo;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * This class is the Logout handler.
 */
public class LogoutServlet extends HttpServlet {

	private static final long serialVersionUID = -2226253641448684463L;

	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		process(request, response);
	}

	protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

		String name = request.getRemoteUser();
		if (name == null) {
			System.out.printf("Non-logged-in user got to LogoutServlet from %s%n", request.getRemoteAddr());
		} else {
			System.out.printf("Logging out user %s%n", name);
		}

        request.getSession().removeAttribute(LoginStuff.LOGIN_FLAG);

        response.sendRedirect(".");
    }


}
{'fraction_non_alphanumeric': 0.09509966777408638, 'fraction_numerical': 0.015780730897009966, 'mean_word_length': 5.161125319693094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3192260', 'n_tokens_mistral': 699, 'n_tokens_neox': 653, 'n_words': 168}