Buggy code:
public class ReloadInterceptor extends BaseInterceptor { boolean fullReload = true ; int dependManagerNote = - 1 ; public ReloadInterceptor ( ) { } public void engineInit ( ContextManager cm ) throws TomcatException { } public void setFullReload ( boolean full ) { } public void addContext ( ContextManager cm , Context context ) throws TomcatException { } public void contextInit ( Context context ) throws TomcatException { } public void reload ( Request req , Context context ) throws TomcatException { } protected void loaderHook ( DependManager dm , Context context ) { } public int contextMap ( Request request ) { Context ctx = request . getContext ( ) ; if ( ctx == null ) return 0 ; if ( ! ( ctx . getReloadable ( ) ) ) return 0 ; if ( ( request . getAttribute ( "tomcat.ReloadInterceptor" ) ) != null ) <START_BUG> return DECLINED ; <END_BUG> DependManager dm = ( ( DependManager ) ( ctx . getContainer ( ) . getNote ( dependManagerNote ) ) ) ; if ( ! ( dm . shouldReload ( ) ) ) return 0 ; if ( ( debug ) > 0 ) log ( ( "Detected<seq2seq4repair_space>changes<seq2seq4repair_space>in<seq2seq4repair_space>" + ( ctx . toString ( ) ) ) ) ; try { ContextManager cm = ctx . getContextManager ( ) ; if ( fullReload ) { Vector sI = new Vector ( ) ; BaseInterceptor [ ] eI ; eI = ctx . getContainer ( ) . getInterceptors ( ) ; for ( int i = 0 ; i < ( eI . length ) ; i ++ ) if ( ctx == ( eI [ i ] . getContext ( ) ) ) sI . addElement ( eI [ i ] ) ; Enumeration e ; Context ctx1 = cm . createContext ( ) ; ctx1 . setContextManager ( cm ) ; ctx1 . setPath ( ctx . getPath ( ) ) ; ctx1 . setDocBase ( ctx . getDocBase ( ) ) ; ctx1 . setReloadable ( ctx . getReloadable ( ) ) ; ctx1 . setDebug ( ctx . getDebug ( ) ) ; ctx1 . setHost ( ctx . getHost ( ) ) ; ctx1 . setTrusted ( ctx . isTrusted ( ) ) ; e = ctx . getHostAliases ( ) ; while ( e . hasMoreElements ( ) ) ctx1 . addHostAlias ( ( ( String ) ( e . nextElement ( ) ) ) ) ; cm . removeContext ( ctx ) ; cm . addContext ( ctx1 ) ; e = sI . elements ( ) ; while ( e . hasMoreElements ( ) ) { BaseInterceptor savedI = ( ( BaseInterceptor ) ( e . nextElement ( ) ) ) ; ctx1 . addInterceptor ( savedI ) ; savedI . setContext ( ctx1 ) ; savedI . reload ( request , ctx1 ) ; } ctx1 . init ( ) ; request . setAttribute ( "tomcat.ReloadInterceptor" , this ) ; BaseInterceptor [ ] ri = cm . getContainer ( ) . getInterceptors ( H_contextMap ) ; for ( int i = 0 ; i < ( ri . length ) ; i ++ ) { if ( ( ri [ i ] ) == ( this ) ) break ; int status = ri [ i ] . contextMap ( request ) ; if ( status != 0 ) return status ; } } else { Enumeration sE = ctx . getServletNames ( ) ; while ( sE . hasMoreElements ( ) ) { try { String sN = ( ( String ) ( sE . nextElement ( ) ) ) ; Handler sw = ctx . getServletByName ( sN ) ; sw . reload ( ) ; } catch ( Exception ex ) { log ( ( "Reload<seq2seq4repair_space>exception:<seq2seq4repair_space>" + ex ) ) ; } } if ( ( debug ) > 0 ) log ( ( "Reloading<seq2seq4repair_space>hooks<seq2seq4repair_space>for<seq2seq4repair_space>context<seq2seq4repair_space>" + ( ctx . toString ( ) ) ) ) ; BaseInterceptor [ ] cI = ctx . getContainer ( ) . getInterceptors ( ) ; for ( int i = 0 ; i < ( cI . length ) ; i ++ ) { cI [ i ] . reload ( request , ctx ) ; ctx . getContainer ( ) . setNote ( "oldLoader" , null ) ; } } } catch ( TomcatException ex ) { log ( ( "Error<seq2seq4repair_space>reloading<seq2seq4repair_space>" + ex ) ) ; } return 0 ; } }

Fix:
return 0 ;