[Bug 70163] Missing null check for findManagedBean result in StoreConfigLifecycleListener
[email protected] Tue, 28 Jul 2026 13:28:05 +0000
| Newsgroups | gmane.comp.jakarta.tomcat.devel |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bz.apache.org/bugzilla/show_bug.cgi?id=3D70163 --- Comment #2 from Timofei <[email protected]> --- I sincerely apologize for the confusion in the original description. You are completely correct; I misstated the current behavior of the code.=20 The current code in StoreConfigLifecycleListener.getManagedBean() does NOT throw an IllegalStateException. It currently dereferences the result of findManagedBean() directly without any null check: ManagedBean managedBean =3D registry.findManagedBean("StoreConfig"); return managedBean.createMBean(object); Because findManagedBean() can return null, this direct dereference causes a potential NullPointerException (as flagged by the Svace static analyzer). The proposed patch adds a missing null check. I chose to return null to all= ow the caller to handle the missing configuration gracefully. However, if thro= wing an IllegalStateException is the preferred Tomcat pattern for a missing requ= ired MBean during startup, I am happy to update the patch to do that instead. Again, apologies for the inaccurate description. This was my error in analy= zing the existing code. --=20 You are receiving this mail because: You are the assignee for the bug.=