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

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


The following commit(s) were added to refs/heads/master by this push:
     new 51ecab5  ARTEMIS-2803 avoid NPE w/o cluster-connection
     new 8fe1bb1  This closes #3182
51ecab5 is described below

commit 51ecab5141c194d60cb61ded0502a54b158f7851
Author: Justin Bertram <jbert...@apache.org>
AuthorDate: Fri Jun 12 14:51:38 2020 -0500

    ARTEMIS-2803 avoid NPE w/o cluster-connection
---
 .../apache/activemq/artemis/core/server/ActiveMQServerLogger.java   | 5 +++++
 .../activemq/artemis/core/server/cluster/ClusterController.java     | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 782fdd5..ced6ee4 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -1687,6 +1687,11 @@ public interface ActiveMQServerLogger extends 
BasicLogger {
       format = Message.Format.MESSAGE_FORMAT)
    void noMatchingBindingsOnDLAWithAutoCreateDLAResources(SimpleString 
address, String message);
 
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 222290, value = "Failed to find cluster-connection when 
handling cluster-connect packet. Ignoring: {0}",
+      format = Message.Format.MESSAGE_FORMAT)
+   void failedToFindClusterConnection(String packet);
+
    @LogMessage(level = Logger.Level.ERROR)
    @Message(id = 224000, value = "Failure in initialisation", format = 
Message.Format.MESSAGE_FORMAT)
    void initializationError(@Cause Throwable e);
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java
index 26ff24d..1805b0d 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java
@@ -359,6 +359,12 @@ public class ClusterController implements 
ActiveMQComponent {
                   clusterConnection = 
server.getClusterManager().getDefaultConnection(null);
                }
 
+               //if there is no default cluster connection then just ignore 
the packet with a log message
+               if (clusterConnection == null) {
+                  
ActiveMQServerLogger.LOGGER.failedToFindClusterConnection(packet.toString());
+                  return;
+               }
+
                ClusterConnectMessage msg = (ClusterConnectMessage) packet;
 
                if (server.getConfiguration().isSecurityEnabled() && 
!clusterConnection.verify(msg.getClusterUser(), msg.getClusterPassword())) {

Reply via email to