From 1859170e69f8765e0656b1259363dc40f8ac59fc Mon Sep 17 00:00:00 2001 From: Hyunjin Choi Date: Thu, 13 Feb 2020 17:57:14 +0900 Subject: [PATCH] Change String comparison to equals() from == (#10022) Motivation: Even if it was stored in the string constant pool, I thought it was safe to compare it through the Equals() method. Modification: So, I changed "==" comparison to equals() comparison Result: It has become safer to compare String values with different references and with the same values. --- .../java/io/netty/handler/codec/http2/LastInboundHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java index 38f400af14..dcb9fb3d34 100644 --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/LastInboundHandler.java @@ -99,7 +99,7 @@ public class LastInboundHandler extends ChannelDuplexHandler { @Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { - if (writabilityStates == "") { + if ("".equals(writabilityStates)) { writabilityStates = String.valueOf(ctx.channel().isWritable()); } else { writabilityStates += "," + ctx.channel().isWritable();