From 6980e0de6584683cc871bc478d236c46526d4076 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 098ceb7dcc..f7a8382059 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 @@ -94,7 +94,7 @@ public class LastInboundHandler implements ChannelHandler { @Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { - if (writabilityStates == "") { + if ("".equals(writabilityStates)) { writabilityStates = String.valueOf(ctx.channel().isWritable()); } else { writabilityStates += "," + ctx.channel().isWritable();