Buggy code:
@ SuppressWarnings ( "serial" ) public abstract class FrameworkServlet extends HttpServletBean { public static final String DEFAULT_NAMESPACE_SUFFIX = "-servlet" ; public static final Class < ? > DEFAULT_CONTEXT_CLASS = XmlWebApplicationContext . class ; public static final String SERVLET_CONTEXT_PREFIX = ( FrameworkServlet . class . getName ( ) ) + ".CONTEXT." ; private static final String INIT_PARAM_DELIMITERS = ",;<seq2seq4repair_space>\t\n" ; private String contextAttribute ; private Class < ? > contextClass = FrameworkServlet . DEFAULT_CONTEXT_CLASS ; private String contextId ; private String namespace ; private String contextConfigLocation ; private boolean publishContext = true ; private boolean publishEvents = true ; private boolean threadContextInheritable = false ; private boolean dispatchOptionsRequest = false ; private boolean dispatchTraceRequest = false ; private WebApplicationContext webApplicationContext ; private boolean refreshEventReceived = false ; private String contextInitializerClasses ; private ArrayList < ApplicationContextInitializer < ConfigurableApplicationContext > > contextInitializers = new ArrayList < ApplicationContextInitializer < ConfigurableApplicationContext > > ( ) ; public FrameworkServlet ( ) { } public FrameworkServlet ( WebApplicationContext webApplicationContext ) { } public void setContextAttribute ( String contextAttribute ) { } public String getContextAttribute ( ) { } public void setContextClass ( Class < ? > contextClass ) { } public Class < ? > getContextClass ( ) { } public void setContextId ( String contextId ) { } public String getContextId ( ) { } public void setNamespace ( String namespace ) { } public String getNamespace ( ) { } public void setContextInitializerClasses ( String contextInitializerClasses ) { } public void setContextInitializers ( ApplicationContextInitializer < ConfigurableApplicationContext > ... contextInitializers ) { } public void setContextConfigLocation ( String contextConfigLocation ) { } public String getContextConfigLocation ( ) { } public void setPublishContext ( boolean publishContext ) { } public void setPublishEvents ( boolean publishEvents ) { } public void setThreadContextInheritable ( boolean threadContextInheritable ) { } public void setDispatchOptionsRequest ( boolean dispatchOptionsRequest ) { } public void setDispatchTraceRequest ( boolean dispatchTraceRequest ) { } @ Override protected final void initServletBean ( ) throws ServletException { } protected WebApplicationContext initWebApplicationContext ( ) { } protected WebApplicationContext findWebApplicationContext ( ) { } protected WebApplicationContext createWebApplicationContext ( ApplicationContext parent ) { } protected void configureAndRefreshWebApplicationContext ( ConfigurableWebApplicationContext wac ) { } protected WebApplicationContext createWebApplicationContext ( WebApplicationContext parent ) { } @ SuppressWarnings ( "unchecked" ) protected void applyInitializers ( ConfigurableApplicationContext wac ) { } protected void postProcessWebApplicationContext ( ConfigurableWebApplicationContext wac ) { } public String getServletContextAttributeName ( ) { } public final WebApplicationContext getWebApplicationContext ( ) { } protected void initFrameworkServlet ( ) throws ServletException { } public void refresh ( ) { } public void onApplicationEvent ( ContextRefreshedEvent event ) { } protected void onRefresh ( ApplicationContext context ) { } @ Override protected void service ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected final void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected final void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected final void doPut ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected final void doDelete ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected void doOptions ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected void doTrace ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } protected final void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { long startTime = System . currentTimeMillis ( ) ; Throwable failureCause = null ; LocaleContext previousLocaleContext = LocaleContextHolder . getLocaleContext ( ) ; LocaleContext localeContext = buildLocaleContext ( request ) ; RequestAttributes previousAttributes = RequestContextHolder . getRequestAttributes ( ) ; ServletRequestAttributes requestAttributes = null ; <START_BUG> if ( ( previousAttributes == null ) || ( previousAttributes . getClass ( ) . equals ( ServletRequestAttributes . class ) ) ) { <END_BUG> requestAttributes = new ServletRequestAttributes ( request ) ; } initContextHolders ( request , localeContext , requestAttributes ) ; WebAsyncManager asyncManager = WebAsyncUtils . getAsyncManager ( request ) ; asyncManager . registerCallableInterceptor ( FrameworkServlet . class . getName ( ) , getRequestBindingInterceptor ( request ) ) ; try { doService ( request , response ) ; } catch ( ServletException ex ) { failureCause = ex ; throw ex ; } catch ( IOException ex ) { failureCause = ex ; throw ex ; } catch ( Throwable ex ) { failureCause = ex ; throw new NestedServletException ( "Request<seq2seq4repair_space>processing<seq2seq4repair_space>failed" , ex ) ; } finally { resetContextHolders ( request , previousLocaleContext , previousAttributes ) ; if ( requestAttributes != null ) { requestAttributes . requestCompleted ( ) ; } if ( logger . isDebugEnabled ( ) ) { if ( failureCause != null ) { this . logger . debug ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>complete<seq2seq4repair_space>request" , failureCause ) ; } else { if ( asyncManager . isConcurrentHandlingStarted ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Leaving<seq2seq4repair_space>response<seq2seq4repair_space>open<seq2seq4repair_space>for<seq2seq4repair_space>concurrent<seq2seq4repair_space>processing" ) ; } } else { this . logger . debug ( "Successfully<seq2seq4repair_space>completed<seq2seq4repair_space>request" ) ; } } } if ( this . publishEvents ) { long processingTime = ( System . currentTimeMillis ( ) ) - startTime ; this . webApplicationContext . publishEvent ( new org . springframework . web . context . support . ServletRequestHandledEvent ( this , request . getRequestURI ( ) , request . getRemoteAddr ( ) , request . getMethod ( ) , getServletConfig ( ) . getServletName ( ) , WebUtils . getSessionId ( request ) , getUsernameForRequest ( request ) , processingTime , failureCause ) ) ; } } } protected LocaleContext buildLocaleContext ( HttpServletRequest request ) { } private void initContextHolders ( HttpServletRequest request , LocaleContext localeContext , RequestAttributes attributes ) { } private void resetContextHolders ( HttpServletRequest request , LocaleContext prevLocaleContext , RequestAttributes previousAttributes ) { } private CallableProcessingInterceptor getRequestBindingInterceptor ( final HttpServletRequest request ) { }

Fix:
if ( ( previousAttributes == null ) || ( previousAttributes instanceof ServletRequestAttributes ) ) {