diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 089dccaecb..ff1089358c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -862,18 +862,12 @@ public class NettyAcceptor extends AbstractAcceptor { return this; } - private static String getProtocols(Map protocolManager) { - StringBuilder sb = new StringBuilder(); - if (protocolManager != null) { - Set strings = protocolManager.keySet(); - for (String string : strings) { - if (sb.length() > 0) { - sb.append(","); - } - sb.append(string); - } + private static String getProtocols(final Map protocolManagers) { + if (protocolManagers == null || protocolManagers.isEmpty()) { + return ""; } - return sb.toString(); + + return String.join(",", protocolManagers.keySet()); } // Inner classes -----------------------------------------------------------------------------