From: Robert Varga Date: Fri, 15 May 2015 15:27:38 +0000 (+0200) Subject: Do not use string concat X-Git-Tag: release/lithium~35 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=8e6748b6570aa25cbfbba6239baf583e77af7cc0;p=openflowjava.git Do not use string concat Usigng strign concat has performance impact even when the message is not logged. Change-Id: I8d588944028ca984474974f4c042f15ea9029396 Signed-off-by: Robert Varga --- diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java index 78734fc4..85bb5d55 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java @@ -11,9 +11,7 @@ package org.opendaylight.openflowjava.protocol.impl.core; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; - import java.util.List; - import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +36,7 @@ public class OFVersionDetector extends ByteToMessageDecoder { } @Override - protected void decode(ChannelHandlerContext chc, ByteBuf bb, List list) throws Exception { + protected void decode(final ChannelHandlerContext chc, final ByteBuf bb, final List list) throws Exception { if (bb.readableBytes() == 0) { LOGGER.debug("not enough data"); bb.release(); @@ -46,12 +44,12 @@ public class OFVersionDetector extends ByteToMessageDecoder { } byte version = bb.readByte(); if ((version == OF13_VERSION_ID) || (version == OF10_VERSION_ID)) { - LOGGER.debug("detected version: " + version); + LOGGER.debug("detected version: {}", version); ByteBuf messageBuffer = bb.slice(); list.add(new VersionMessageWrapper(version, messageBuffer)); messageBuffer.retain(); } else { - LOGGER.warn("detected version: " + version + " - currently not supported"); + LOGGER.warn("detected version: {} - currently not supported", version); } bb.skipBytes(bb.readableBytes()); }