@@ -521,21 +521,8 @@ public void doHandle(String target, Request baseRequest, HttpServletRequest requ
521521 FilterChain chain = null ;
522522
523523 // find the servlet
524- if (target .startsWith ("/" ))
525- {
526- if (servletHolder != null && _filterMappings != null && _filterMappings .length > 0 )
527- chain = getFilterChain (baseRequest , target , servletHolder );
528- }
529- else
530- {
531- if (servletHolder != null )
532- {
533- if (_filterMappings != null && _filterMappings .length > 0 )
534- {
535- chain = getFilterChain (baseRequest , null , servletHolder );
536- }
537- }
538- }
524+ if (servletHolder != null && _filterMappings != null && _filterMappings .length > 0 )
525+ chain = getFilterChain (baseRequest , target .startsWith ("/" ) ? target : null , servletHolder );
539526
540527 if (LOG .isDebugEnabled ())
541528 LOG .debug ("chain={}" , chain );
@@ -593,6 +580,7 @@ public MappedResource<ServletHolder> getMappedServlet(String target)
593580
594581 protected FilterChain getFilterChain (Request baseRequest , String pathInContext , ServletHolder servletHolder )
595582 {
583+ Objects .requireNonNull (servletHolder );
596584 String key = pathInContext == null ? servletHolder .getName () : pathInContext ;
597585 int dispatch = FilterMapping .dispatch (baseRequest .getDispatcherType ());
598586
@@ -608,7 +596,7 @@ protected FilterChain getFilterChain(Request baseRequest, String pathInContext,
608596 // The mappings lists have been reversed to make this simple and fast.
609597 FilterChain chain = null ;
610598
611- if (servletHolder != null && _filterNameMappings != null && !_filterNameMappings .isEmpty ())
599+ if (_filterNameMappings != null && !_filterNameMappings .isEmpty ())
612600 {
613601 if (_wildFilterNameMappings != null )
614602 for (FilterMapping mapping : _wildFilterNameMappings )
@@ -1626,6 +1614,7 @@ static class ChainEnd implements FilterChain
16261614
16271615 ChainEnd (ServletHolder holder )
16281616 {
1617+ Objects .requireNonNull (holder );
16291618 _servletHolder = holder ;
16301619 }
16311620
0 commit comments