Skip to content

Commit

Permalink
Change String comparison to equals() from == (#10022)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hyeonisism committed Feb 13, 2020
1 parent f88a343 commit 1859170
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {

@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
if (writabilityStates == "") {
if ("".equals(writabilityStates)) {
writabilityStates = String.valueOf(ctx.channel().isWritable());
} else {
writabilityStates += "," + ctx.channel().isWritable();
Expand Down

0 comments on commit 1859170

Please sign in to comment.