This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 66753af1af Avoid possible NPE
66753af1af is described below

commit 66753af1afe95fde4a64c86cdcf7fbeb7a7986a0
Author: remm <[email protected]>
AuthorDate: Fri May 15 14:04:42 2026 +0200

    Avoid possible NPE
    
    init uses if (this.domain != null) so destroy should do the same thing.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index de07ec7f94..47148bf634 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -2340,11 +2340,13 @@ public abstract class AbstractEndpoint<S, U> {
             unbind();
             bindState = BindState.UNBOUND;
         }
-        Registry registry = Registry.getRegistry(null);
-        registry.unregisterComponent(oname);
-        registry.unregisterComponent(socketProperties.getObjectName());
-        for (SSLHostConfig sslHostConfig : findSslHostConfigs()) {
-            unregisterJmx(sslHostConfig);
+        if (this.domain != null) {
+            Registry registry = Registry.getRegistry(null);
+            registry.unregisterComponent(oname);
+            registry.unregisterComponent(socketProperties.getObjectName());
+            for (SSLHostConfig sslHostConfig : findSslHostConfigs()) {
+                unregisterJmx(sslHostConfig);
+            }
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to