diff --git a/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsOptPseudoRrRecord.java b/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsOptPseudoRrRecord.java index 3a93f43f22..13439c1686 100644 --- a/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsOptPseudoRrRecord.java +++ b/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsOptPseudoRrRecord.java @@ -38,7 +38,7 @@ public abstract class AbstractDnsOptPseudoRrRecord extends AbstractDnsRecord imp // See https://tools.ietf.org/html/rfc6891#section-6.1.3 private static long packIntoLong(int val, int val2) { // We are currently not support DO and Z fields, just use 0. - return ((val & 0xff) << 24 | (val2 & 0xff) << 16 | (0 & 0xff) << 8 | 0 & 0xff) & 0xFFFFFFFFL; + return ((val & 0xffL) << 24 | (val2 & 0xff) << 16) & 0xFFFFFFFFL; } @Override diff --git a/codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordEncoderTest.java b/codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordEncoderTest.java index 91e9d5a3f2..260db4e70e 100644 --- a/codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordEncoderTest.java +++ b/codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordEncoderTest.java @@ -97,7 +97,7 @@ public class DefaultDnsRecordEncoderTest { // Pad the leftover of the last byte with zeros. int idx = addressPart.writerIndex() - 1; byte lastByte = addressPart.getByte(idx); - int paddingMask = ~((1 << (8 - lowOrderBitsToPreserve)) - 1); + int paddingMask = -1 << 8 - lowOrderBitsToPreserve; addressPart.setByte(idx, lastByte & paddingMask); } diff --git a/handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java b/handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java index fcfd2df537..ef1d487ddc 100644 --- a/handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java +++ b/handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java @@ -167,7 +167,7 @@ public final class IpSubnetFilterRule implements IpFilterRule, Comparable