[activemq] branch master updated: [AMQ-7301] Display warn in case of STOMP stream initialize error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[activemq] branch master updated: [AMQ-7301] Display warn in case of STOMP stream initialize error

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d11fd05  [AMQ-7301] Display warn in case of STOMP stream initialize error
     new 0d01314  Merge pull request #488 from jbonofre/AMQ-7301
d11fd05 is described below

commit d11fd05af4db5f3af46e09c9d9c62821c5b66967
Author: jbonofre <[hidden email]>
AuthorDate: Mon Mar 2 08:03:36 2020 +0100

    [AMQ-7301] Display warn in case of STOMP stream initialize error
---
 .../activemq/transport/stomp/StompNIOSSLTransport.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java
index 09757a4..5e899ae 100644
--- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java
+++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java
@@ -29,9 +29,13 @@ import javax.net.ssl.SSLEngine;
 
 import org.apache.activemq.transport.nio.NIOSSLTransport;
 import org.apache.activemq.wireformat.WireFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class StompNIOSSLTransport extends NIOSSLTransport {
 
+    private final static Logger LOGGER = LoggerFactory.getLogger(StompNIOSSLTransport.class);
+
     StompCodec codec;
 
     private X509Certificate[] cachedPeerCerts;
@@ -52,11 +56,15 @@ public class StompNIOSSLTransport extends NIOSSLTransport {
     }
 
     @Override
-    protected void initializeStreams() throws IOException {
-        codec = new StompCodec(this);
-        super.initializeStreams();
-        if (inputBuffer.position() != 0 && inputBuffer.hasRemaining()) {
-            serviceRead();
+    protected void initializeStreams() {
+        try {
+            codec = new StompCodec(this);
+            super.initializeStreams();
+            if (inputBuffer.position() != 0 && inputBuffer.hasRemaining()) {
+                serviceRead();
+            }
+        } catch (IOException e) {
+            LOGGER.warn("Could not initialize connection from {}", socket.getInetAddress().getHostAddress(), e);
         }
     }