From d11fd05af4db5f3af46e09c9d9c62821c5b66967 Mon Sep 17 00:00:00 2001 From: jbonofre Date: Mon, 2 Mar 2020 08:03:36 +0100 Subject: [PATCH] [AMQ-7301] Display warn in case of STOMP stream initialize error --- .../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 09757a447c..5e899aeddf 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); } }