<commit_before>package org.eclipse.jetty.continuation;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class ContinuationFilter implements Filter
{
    final boolean _jetty=true;
    ServletContext _context;

    public void init(FilterConfig filterConfig) throws ServletException
    {
        _context = filterConfig.getServletContext();
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
    {
        if (_jetty)
            chain.doFilter(request,response);
        else
        {
            final FauxContinuation fc = new FauxContinuation();
            request.setAttribute(Continuation.ATTRIBUTE,fc);
            boolean complete=false;
      
            while (!complete)
            {
                try
                {
                    chain.doFilter(request,response);
                }
                catch(IOException e)
                {
                    _context.log("OpenServletFilter caught ",e);
                }
                catch(ServletException e)
                {
                    _context.log("OpenServletFilter caught ",e);
                }
                finally
                {
                    complete=fc.handleSuspension();
                }
            }
        }
    }
    
    public void destroy()
    {
    }


    
    private class FauxContinuation implements Continuation
    {
        private static final int __HANDLING=1;   // Request dispatched to filter/servlet
        private static final int __SUSPENDING=2;   // Suspend called, but not yet returned to container
        private static final int __RESUMING=3;     // resumed while suspending
        private static final int __COMPLETING=4;   // resumed while suspending or suspended<commit_msg>faux switch<commit_after>package org.eclipse.jetty.continuation;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class ContinuationFilter implements Filter
{
    boolean _faux;
    ServletContext _context;

    public void init(FilterConfig filterConfig) throws ServletException
    {
        _context = filterConfig.getServletContext();
        _faux=!"org.eclipse.jetty.servlet".equals(filterConfig.getClass().getPackage().getName());
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
    {
        if (_faux)
        {
            final FauxContinuation fc = new FauxContinuation();
            request.setAttribute(Continuation.ATTRIBUTE,fc);
            boolean complete=false;
      
            while (!complete)
            {
                try
                {
                    chain.doFilter(request,response);
                }
                catch(IOException e)
                {
                    _context.log("OpenServletFilter caught ",e);
                }
                catch(ServletException e)
                {
                    _context.log("OpenServletFilter caught ",e);
                }
                finally
                {
                    complete=fc.handleSuspension();
                }
            }
        }
        else
            chain.doFilter(request,response);
    }
    
    public void destroy()
    {
    }


    
    private class FauxContinuation implements Continuation
    {
        private static final int __HANDLING=1;   // Request dispatched to filter/servlet
        private static final int __SUSPENDING=2;   // Suspend called, but not yet returned to container
        private static final int __RESUMING=3;     // resumed while suspending
        private static final int __COMPLETING=4;   // resumed while suspending or suspended
{'fraction_non_alphanumeric': 0.07014643363249883, 'fraction_numerical': 0.001889466225791214, 'mean_word_length': 1.980295566502463, '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': '5016445', 'n_tokens_mistral': 1044, 'n_tokens_neox': 998, 'n_words': 250}