Bug 61781 - NPE in PersistentProviderRegistrations.writeProviders() if layer or app context are null
Summary: NPE in PersistentProviderRegistrations.writeProviders() if layer or app conte...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.23
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-18 14:02 UTC by Lazar Kirchev
Modified: 2017-11-20 18:17 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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