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 GitHub
parent f88a343455
commit 1859170e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();