diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java index 893eb11210..fbea998804 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java @@ -69,12 +69,10 @@ public class WebSocket00FrameEncoder extends MessageToMessageEncoder { decodedClientId.value, willProperties, decodedWillTopic != null ? decodedWillTopic.value : null, - decodedWillMessage != null ? decodedWillMessage : null, + decodedWillMessage, decodedUserName != null ? decodedUserName.value : null, - decodedPassword != null ? decodedPassword : null); + decodedPassword); return new Result(mqttConnectPayload, numberOfBytesConsumed); } diff --git a/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlElementStart.java b/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlElementStart.java index be681232bb..69e78d4ae5 100644 --- a/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlElementStart.java +++ b/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlElementStart.java @@ -47,11 +47,7 @@ public class XmlElementStart extends XmlElement { XmlElementStart that = (XmlElementStart) o; - if (!attributes.equals(that.attributes)) { - return false; - } - - return true; + return attributes.equals(that.attributes); } @Override diff --git a/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlEntityReference.java b/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlEntityReference.java index 212f68d755..387cb7fe5b 100644 --- a/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlEntityReference.java +++ b/codec-xml/src/main/java/io/netty/handler/codec/xml/XmlEntityReference.java @@ -50,11 +50,7 @@ public class XmlEntityReference { if (name != null ? !name.equals(that.name) : that.name != null) { return false; } - if (text != null ? !text.equals(that.text) : that.text != null) { - return false; - } - - return true; + return text != null ? text.equals(that.text) : that.text == null; } @Override diff --git a/common/src/main/java/io/netty/util/internal/ConstantTimeUtils.java b/common/src/main/java/io/netty/util/internal/ConstantTimeUtils.java index b270a52093..d328788160 100644 --- a/common/src/main/java/io/netty/util/internal/ConstantTimeUtils.java +++ b/common/src/main/java/io/netty/util/internal/ConstantTimeUtils.java @@ -34,7 +34,7 @@ public final class ConstantTimeUtils { * @return {@code 0} if not equal. {@code 1} if equal. */ public static int equalsConstantTime(int x, int y) { - int z = -1 ^ (x ^ y); + int z = ~(x ^ y); z &= z >> 16; z &= z >> 8; z &= z >> 4; @@ -59,7 +59,7 @@ public final class ConstantTimeUtils { * @return {@code 0} if not equal. {@code 1} if equal. */ public static int equalsConstantTime(long x, long y) { - long z = -1L ^ (x ^ y); + long z = ~(x ^ y); z &= z >> 32; z &= z >> 16; z &= z >> 8;