From f209722a19c5e18cd2371ace62aa20a753a8acc8 Mon Sep 17 00:00:00 2001 From: Vivek Ratnavel Subramanian Date: Fri, 4 Oct 2019 16:36:32 -0700 Subject: [PATCH] HDDS-2257. Fix checkstyle issues in ChecksumByteBuffer (#1603) --- .../ozone/common/ChecksumByteBuffer.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBuffer.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBuffer.java index 2c0feffbc4b..7ce643db471 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBuffer.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBuffer.java @@ -47,6 +47,7 @@ public interface ChecksumByteBuffer extends Checksum { * An abstract class implementing {@link ChecksumByteBuffer} * with a 32-bit checksum and a lookup table. */ + @SuppressWarnings("innerassignment") abstract class CrcIntTable implements ChecksumByteBuffer { /** Current CRC value with bit-flipped. */ private int crc; @@ -98,14 +99,21 @@ public interface ChecksumByteBuffer extends Checksum { // loop unroll - duff's device style switch (b.remaining()) { - case 7: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 6: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 5: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 4: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 3: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 2: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - case 1: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; - default: // noop + case 7: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 6: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 5: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 4: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 3: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 2: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + case 1: + crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; + default: // noop } return crc;