@@ -521,21 +521,8 @@ public void doHandle(String target, Request baseRequest, HttpServletRequest requ
521
521
FilterChain chain = null ;
522
522
523
523
// 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 );
539
526
540
527
if (LOG .isDebugEnabled ())
541
528
LOG .debug ("chain={}" , chain );
@@ -593,6 +580,7 @@ public MappedResource<ServletHolder> getMappedServlet(String target)
593
580
594
581
protected FilterChain getFilterChain (Request baseRequest , String pathInContext , ServletHolder servletHolder )
595
582
{
583
+ Objects .requireNonNull (servletHolder );
596
584
String key = pathInContext == null ? servletHolder .getName () : pathInContext ;
597
585
int dispatch = FilterMapping .dispatch (baseRequest .getDispatcherType ());
598
586
@@ -608,7 +596,7 @@ protected FilterChain getFilterChain(Request baseRequest, String pathInContext,
608
596
// The mappings lists have been reversed to make this simple and fast.
609
597
FilterChain chain = null ;
610
598
611
- if (servletHolder != null && _filterNameMappings != null && !_filterNameMappings .isEmpty ())
599
+ if (_filterNameMappings != null && !_filterNameMappings .isEmpty ())
612
600
{
613
601
if (_wildFilterNameMappings != null )
614
602
for (FilterMapping mapping : _wildFilterNameMappings )
@@ -1626,6 +1614,7 @@ static class ChainEnd implements FilterChain
1626
1614
1627
1615
ChainEnd (ServletHolder holder )
1628
1616
{
1617
+ Objects .requireNonNull (holder );
1629
1618
_servletHolder = holder ;
1630
1619
}
1631
1620
0 commit comments