Bug 61777

Summary: NPE in AuthConfigFactoryImpl.detachListener()
Product: Tomcat 8 Reporter: Lazar Kirchev <lazar.kirchev>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 8.5.x-trunk   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Lazar Kirchev 2017-11-18 13:44:49 UTC
In case AuthConfigFactoryImpl.detachListener() is called for a combination of layer and appContext for which there is no registration (e.g. because the registration was already removed, or due to wrong layer and/or appContext) the method throws a NPE.

It does not check for null the result from the call to findRegistrationContextImpl, which is null if such registration does not exist.
Comment 1 Lazar Kirchev 2017-11-18 13:48:14 UTC
This pull request contains a test case, which illustrates the problem and a fix for it: https://github.com/apache/tomcat/pull/85
Comment 2 Mark Thomas 2017-11-20 11:54:45 UTC
Thanks for the patch and bonus points for including a test case.

Fixed in:
- trunk for 9.0.2 onwards
- 8.5.x for 8.5.24 onwards