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

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 8cf428a  ARTEMIS-3433 mitigate NPE
     new fa0174b  This closes #3762
8cf428a is described below

commit 8cf428ad49e733bcb3ac73d829f4c1949096ad88
Author: Justin Bertram <[email protected]>
AuthorDate: Tue Sep 21 13:49:32 2021 -0500

    ARTEMIS-3433 mitigate NPE
    
    It is technically possible for
    OpenSSLContextFactoryProvider.getOpenSSLContextFactory() to return
    null so we need to check to avoid an NPE.
---
 .../artemis/core/remoting/server/impl/RemotingServiceImpl.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
index ad2439b..a58c885 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
@@ -71,6 +71,7 @@ import 
org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory;
 import org.apache.activemq.artemis.spi.core.remoting.BufferHandler;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
 import 
org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener;
+import org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactory;
 import 
org.apache.activemq.artemis.spi.core.remoting.ssl.OpenSSLContextFactoryProvider;
 import 
org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactoryProvider;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
@@ -386,7 +387,10 @@ public class RemotingServiceImpl implements 
RemotingService, ServerConnectionLif
          return;
       }
       SSLContextFactoryProvider.getSSLContextFactory().clearSSLContexts();
-      
OpenSSLContextFactoryProvider.getOpenSSLContextFactory().clearSslContexts();
+      OpenSSLContextFactory openSSLContextFactory = 
OpenSSLContextFactoryProvider.getOpenSSLContextFactory();
+      if (openSSLContextFactory != null) {
+         openSSLContextFactory.clearSslContexts();
+      }
 
       failureCheckAndFlushThread.close(criticalError);
 

Reply via email to