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.
This commit is contained in:
Hyunjin Choi 2020-02-13 17:57:14 +09:00 committed by Norman Maurer
parent 064ab7afa8
commit 6980e0de65

View File

@ -94,7 +94,7 @@ public class LastInboundHandler implements ChannelHandler {
@Override @Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
if (writabilityStates == "") { if ("".equals(writabilityStates)) {
writabilityStates = String.valueOf(ctx.channel().isWritable()); writabilityStates = String.valueOf(ctx.channel().isWritable());
} else { } else {
writabilityStates += "," + ctx.channel().isWritable(); writabilityStates += "," + ctx.channel().isWritable();