This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new fd8be3739a Fix possible NPE fd8be3739a is described below commit fd8be3739a5201ca99e1f71415c10ba3fcc02283 Author: remm <r...@apache.org> AuthorDate: Fri Sep 8 15:40:52 2023 +0200 Fix possible NPE Found by coverity. --- java/org/apache/catalina/mbeans/LocalStrings.properties | 1 + java/org/apache/catalina/mbeans/MBeanFactory.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/java/org/apache/catalina/mbeans/LocalStrings.properties b/java/org/apache/catalina/mbeans/LocalStrings.properties index 4176cbfdcd..4710ad81ac 100644 --- a/java/org/apache/catalina/mbeans/LocalStrings.properties +++ b/java/org/apache/catalina/mbeans/LocalStrings.properties @@ -16,3 +16,4 @@ mBeanFactory.contextCreate.addServicedFail=Unable to create context [{0}] as another component is currently servicing a context with that name mBeanFactory.contextRemove.addServicedFail=Unable to remove context [{0}] as another component is currently servicing that context mBeanFactory.managerContext=Manager components may only be added to Contexts. +mBeanFactory.noParent=No parent found with object name [{0}] diff --git a/java/org/apache/catalina/mbeans/MBeanFactory.java b/java/org/apache/catalina/mbeans/MBeanFactory.java index f8d4cf6529..9ebf2557a0 100644 --- a/java/org/apache/catalina/mbeans/MBeanFactory.java +++ b/java/org/apache/catalina/mbeans/MBeanFactory.java @@ -232,6 +232,9 @@ public class MBeanFactory { // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); Container container = getParentContainerFromParent(pname); + if (container == null) { + throw new IllegalArgumentException(sm.getString("mBeanFactory.noParent", parent)); + } // Add the new instance to its parent component container.setRealm(realm); // Return the corresponding MBean name --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org