Bug 61781

Summary: NPE in PersistentProviderRegistrations.writeProviders() if layer or app context are null
Product: Tomcat 8 Reporter: Lazar Kirchev <lazar.kirchev>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.5.23   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Lazar Kirchev 2017-11-18 14:02:33 UTC
PersistentProviderRegistrations.writeProviders() throws NPE if it tries to persist a provider with null layer or app context. The NPE is caused by passing null to Writer.write(). However, it is acceptable for a Provider to have its layer and/or app context null.
 
It is allowed by the spec and there is logic which supports this in the AuthConfigFactoryImpl. So the layer and the app context should be treated as optional, just as the description is treated.
Comment 1 Lazar Kirchev 2017-11-18 14:04:07 UTC
This pull request contains a test case which illustrates the problem and a fix for it: https://github.com/apache/tomcat/pull/89
Comment 2 Mark Thomas 2017-11-20 18:17:14 UTC
Again, many thanks.

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