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

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


The following commit(s) were added to refs/heads/main by this push:
     new b53c281c7d Avoid possible NPE
b53c281c7d is described below

commit b53c281c7d5655941380ca585ca4b4da979db5f3
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 777039b5e2..c1cd2f1837 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -2331,11 +2331,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