Bug 63981 - False-positive warning logged when Registry.disableRegistry is called and the registry has already been disabled
Summary: False-positive warning logged when Registry.disableRegistry is called and the...
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Util (show other bugs)
Version: 9.0.x
Hardware: PC All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2019-12-02 09:23 UTC by Andy Wilkinson
Modified: 2019-12-03 09:05 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Andy Wilkinson 2019-12-02 09:23:49 UTC
Calling org.apache.tomcat.util.modeler.Registry.disableRegistry() assigns an instance of NoDescriptorRegistry to the static registry field. Subsequent invocations then log a warning that states that the registry cannot be disabled as it has already been initialised. These feels like a false-positive to me when registry is an instance of NoDescriptorRegistry. To avoid the unwanted warning, could the check be changed to something like the following:

if (registry == null) {
    registry = new NoDescriptorRegistry();
} else if (!registry instanceof NoDescriptorRegistry) {

This would improve log output in integration tests using embedded Tomcat where Tomcat may be initialised multiple times.
Comment 1 Mark Thomas 2019-12-02 21:52:48 UTC
Thanks for the report and the suggested fix. Works for me.

Fixed in:
- master for 9.0.30 onwards
Comment 2 Andy Wilkinson 2019-12-03 09:05:42 UTC
Thanks, Mark. Much appreciated.