This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new 20807faa Use final
20807faa is described below
commit 20807faa152f2eac2ff13d3dcec5b16180b94ad4
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Sep 13 18:10:50 2023 -0400
Use final
Remove extra parens
---
.../org/apache/commons/codec/binary/Base16.java | 4 +-
.../org/apache/commons/codec/binary/Base32.java | 36 +++++++--------
.../org/apache/commons/codec/binary/Base64.java | 34 +++++++-------
.../apache/commons/codec/binary/BaseNCodec.java | 8 ++--
.../java/org/apache/commons/codec/digest/B64.java | 2 +-
.../apache/commons/codec/digest/MurmurHash2.java | 38 ++++++++--------
.../apache/commons/codec/digest/MurmurHash3.java | 52 +++++++++++-----------
.../apache/commons/codec/digest/PureJavaCrc32.java | 30 ++++++-------
.../commons/codec/digest/PureJavaCrc32C.java | 26 +++++------
.../org/apache/commons/codec/digest/UnixCrypt.java | 2 +-
.../org/apache/commons/codec/digest/XXHash32.java | 8 ++--
.../commons/codec/language/ColognePhonetic.java | 2 +-
.../codec/language/DaitchMokotoffSoundex.java | 2 +-
.../commons/codec/language/DoubleMetaphone.java | 40 ++++++++---------
.../org/apache/commons/codec/language/Soundex.java | 2 +-
.../org/apache/commons/codec/net/PercentCodec.java | 4 +-
.../commons/codec/net/QuotedPrintableCodec.java | 4 +-
.../apache/commons/codec/binary/Base32Test.java | 4 +-
.../codec/binary/Base64InputStreamTest.java | 2 +-
.../commons/codec/digest/MurmurHash3Test.java | 8 ++--
.../commons/codec/digest/PureJavaCrc32Test.java | 2 +-
.../language/MatchRatingApproachEncoderTest.java | 2 +-
.../commons/codec/net/CustomRFC1522Codec.java | 10 ++---
23 files changed, 161 insertions(+), 161 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/binary/Base16.java
b/src/main/java/org/apache/commons/codec/binary/Base16.java
index e5366fac..0e1e493f 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base16.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base16.java
@@ -176,7 +176,7 @@ public class Base16 extends BaseNCodec {
int result;
if (dataLen < availableChars) {
// we have 1/2 byte from previous invocation to decode
- result = (context.ibitWorkArea - 1) << BITS_PER_ENCODED_BYTE;
+ result = context.ibitWorkArea - 1 << BITS_PER_ENCODED_BYTE;
result |= decodeOctet(data[offset++]);
buffer[context.pos++] = (byte)result;
@@ -233,7 +233,7 @@ public class Base16 extends BaseNCodec {
final int end = offset + length;
for (int i = offset; i < end; i++) {
final int value = data[i];
- final int high = (value >> BITS_PER_ENCODED_BYTE) & MASK_4BITS;
+ final int high = value >> BITS_PER_ENCODED_BYTE & MASK_4BITS;
final int low = value & MASK_4BITS;
buffer[context.pos++] = encodeTable[high];
buffer[context.pos++] = encodeTable[low];
diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java
b/src/main/java/org/apache/commons/codec/binary/Base32.java
index 520ba960..00cc7f27 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32.java
@@ -386,10 +386,10 @@ public class Base32 extends BaseNCodec {
// collect decoded bytes
context.lbitWorkArea = (context.lbitWorkArea <<
BITS_PER_ENCODED_BYTE) + result;
if (context.modulus == 0) { // we can output the 5 bytes
- buffer[context.pos++] = (byte) ((context.lbitWorkArea
>> 32) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea
>> 24) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea
>> 16) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea
>> 8) & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea
>> 32 & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea
>> 24 & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea
>> 16 & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea
>> 8 & MASK_8BITS);
buffer[context.pos++] = (byte) (context.lbitWorkArea &
MASK_8BITS);
}
}
@@ -414,41 +414,41 @@ public class Base32 extends BaseNCodec {
validateTrailingCharacters();
case 2 : // 10 bits, drop 2 and output one byte
validateCharacter(MASK_2BITS, context);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
2) & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 2
& MASK_8BITS);
break;
case 3 : // 15 bits, drop 7 and output 1 byte, or raise an
exception
validateTrailingCharacters();
// Not possible from a valid encoding but decode anyway
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
7) & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 7
& MASK_8BITS);
break;
case 4 : // 20 bits = 2*8 + 4
validateCharacter(MASK_4BITS, context);
context.lbitWorkArea = context.lbitWorkArea >> 4; // drop
4 bits
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
8) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 8
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea &
MASK_8BITS);
break;
case 5 : // 25 bits = 3*8 + 1
validateCharacter(MASK_1BITS, context);
context.lbitWorkArea = context.lbitWorkArea >> 1;
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
16) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
8) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 16
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 8
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea &
MASK_8BITS);
break;
case 6 : // 30 bits = 3*8 + 6, or raise an exception
validateTrailingCharacters();
// Not possible from a valid encoding but decode anyway
context.lbitWorkArea = context.lbitWorkArea >> 6;
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
16) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
8) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 16
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 8
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea &
MASK_8BITS);
break;
case 7 : // 35 bits = 4*8 +3
validateCharacter(MASK_3BITS, context);
context.lbitWorkArea = context.lbitWorkArea >> 3;
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
24) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
16) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea >>
8) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.lbitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 24
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 16
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea >> 8
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.lbitWorkArea &
MASK_8BITS);
break;
default:
// modulus can be 0-7, and we excluded 0,1 already
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64.java
b/src/main/java/org/apache/commons/codec/binary/Base64.java
index 6c840e90..b856469d 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64.java
@@ -374,7 +374,7 @@ public class Base64 extends BaseNCodec {
* @since 1.4
*/
public static boolean isBase64(final byte octet) {
- return octet == PAD_DEFAULT || (octet >= 0 && octet <
DECODE_TABLE.length && DECODE_TABLE[octet] != -1);
+ return octet == PAD_DEFAULT || octet >= 0 && octet <
DECODE_TABLE.length && DECODE_TABLE[octet] != -1;
}
/**
@@ -420,10 +420,10 @@ public class Base64 extends BaseNCodec {
static byte[] toIntegerBytes(final BigInteger bigInt) {
int bitlen = bigInt.bitLength();
// round bitlen
- bitlen = ((bitlen + 7) >> 3) << 3;
+ bitlen = bitlen + 7 >> 3 << 3;
final byte[] bigBytes = bigInt.toByteArray();
- if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1)
== (bitlen / 8))) {
+ if (bigInt.bitLength() % 8 != 0 && bigInt.bitLength() / 8 + 1 ==
bitlen / 8) {
return bigBytes;
}
// set up params for copying everything but sign bit
@@ -431,7 +431,7 @@ public class Base64 extends BaseNCodec {
int len = bigBytes.length;
// if bigInt is exactly byte-aligned, just skip signbit in copy
- if ((bigInt.bitLength() % 8) == 0) {
+ if (bigInt.bitLength() % 8 == 0) {
startSrc = 1;
len--;
}
@@ -661,8 +661,8 @@ public class Base64 extends BaseNCodec {
context.modulus = (context.modulus+1) %
BYTES_PER_ENCODED_BLOCK;
context.ibitWorkArea = (context.ibitWorkArea <<
BITS_PER_ENCODED_BYTE) + result;
if (context.modulus == 0) {
- buffer[context.pos++] = (byte) ((context.ibitWorkArea
>> 16) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.ibitWorkArea
>> 8) & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.ibitWorkArea
>> 16 & MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.ibitWorkArea
>> 8 & MASK_8BITS);
buffer[context.pos++] = (byte) (context.ibitWorkArea &
MASK_8BITS);
}
}
@@ -685,13 +685,13 @@ public class Base64 extends BaseNCodec {
case 2 : // 12 bits = 8 + 4
validateCharacter(MASK_4BITS, context);
context.ibitWorkArea = context.ibitWorkArea >> 4; // dump
the extra 4 bits
- buffer[context.pos++] = (byte) ((context.ibitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.ibitWorkArea &
MASK_8BITS);
break;
case 3 : // 18 bits = 8 + 8 + 2
validateCharacter(MASK_2BITS, context);
context.ibitWorkArea = context.ibitWorkArea >> 2; // dump
2 bits
- buffer[context.pos++] = (byte) ((context.ibitWorkArea >>
8) & MASK_8BITS);
- buffer[context.pos++] = (byte) ((context.ibitWorkArea) &
MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.ibitWorkArea >> 8
& MASK_8BITS);
+ buffer[context.pos++] = (byte) (context.ibitWorkArea &
MASK_8BITS);
break;
default:
throw new IllegalStateException("Impossible modulus " +
context.modulus);
@@ -739,9 +739,9 @@ public class Base64 extends BaseNCodec {
break;
case 1 : // 8 bits = 6 + 2
// top 6 bits:
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 2) & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 2 & MASK_6BITS];
// remaining 2:
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
<< 4) & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
<< 4 & MASK_6BITS];
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[context.pos++] = pad;
@@ -750,9 +750,9 @@ public class Base64 extends BaseNCodec {
break;
case 2 : // 16 bits = 6 + 6 + 4
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 10) & MASK_6BITS];
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 4) & MASK_6BITS];
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
<< 2) & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 10 & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 4 & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
<< 2 & MASK_6BITS];
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[context.pos++] = pad;
@@ -777,9 +777,9 @@ public class Base64 extends BaseNCodec {
}
context.ibitWorkArea = (context.ibitWorkArea << 8) + b; //
BITS_PER_BYTE
if (0 == context.modulus) { // 3 bytes = 24 bits = 4 * 6 bits
to extract
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 18) & MASK_6BITS];
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 12) & MASK_6BITS];
- buffer[context.pos++] = encodeTable[(context.ibitWorkArea
>> 6) & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 18 & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 12 & MASK_6BITS];
+ buffer[context.pos++] = encodeTable[context.ibitWorkArea
>> 6 & MASK_6BITS];
buffer[context.pos++] = encodeTable[context.ibitWorkArea &
MASK_6BITS];
context.currentLinePos += BYTES_PER_ENCODED_BLOCK;
if (lineLength > 0 && lineLength <=
context.currentLinePos) {
diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
index 47b04193..551befcd 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
@@ -358,7 +358,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
this.unencodedBlockSize = unencodedBlockSize;
this.encodedBlockSize = encodedBlockSize;
final boolean useChunking = lineLength > 0 && chunkSeparatorLength > 0;
- this.lineLength = useChunking ? (lineLength / encodedBlockSize) *
encodedBlockSize : 0;
+ this.lineLength = useChunking ? lineLength / encodedBlockSize *
encodedBlockSize : 0;
this.chunkSeparatorLength = chunkSeparatorLength;
this.pad = pad;
this.decodingPolicy = Objects.requireNonNull(decodingPolicy,
"codecPolicy");
@@ -594,10 +594,10 @@ public abstract class BaseNCodec implements
BinaryEncoder, BinaryDecoder {
public long getEncodedLength(final byte[] pArray) {
// Calculate non-chunked size - rounded up to allow for padding
// cast to long is needed to avoid possibility of overflow
- long len = ((pArray.length + unencodedBlockSize-1) /
unencodedBlockSize) * (long) encodedBlockSize;
+ long len = (pArray.length + unencodedBlockSize-1) /
unencodedBlockSize * (long) encodedBlockSize;
if (lineLength > 0) { // We're using chunking
// Round up to nearest multiple
- len += ((len + lineLength-1) / lineLength) * chunkSeparatorLength;
+ len += (len + lineLength-1) / lineLength * chunkSeparatorLength;
}
return len;
}
@@ -635,7 +635,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
public boolean isInAlphabet(final byte[] arrayOctet, final boolean
allowWSPad) {
for (final byte octet : arrayOctet) {
if (!isInAlphabet(octet) &&
- (!allowWSPad || (octet != pad) &&
!Character.isWhitespace(octet))) {
+ (!allowWSPad || octet != pad &&
!Character.isWhitespace(octet))) {
return false;
}
}
diff --git a/src/main/java/org/apache/commons/codec/digest/B64.java
b/src/main/java/org/apache/commons/codec/digest/B64.java
index a828a2cb..c3da98ee 100644
--- a/src/main/java/org/apache/commons/codec/digest/B64.java
+++ b/src/main/java/org/apache/commons/codec/digest/B64.java
@@ -57,7 +57,7 @@ class B64 {
static void b64from24bit(final byte b2, final byte b1, final byte b0,
final int outLen,
final StringBuilder buffer) {
// The bit masking is necessary because the JVM byte type is signed!
- int w = ((b2 << 16) & 0x00ffffff) | ((b1 << 8) & 0x00ffff) | (b0 &
0xff);
+ int w = b2 << 16 & 0x00ffffff | b1 << 8 & 0x00ffff | b0 & 0xff;
// It's effectively a "for" loop but kept to resemble the original C
code.
int n = outLen;
while (n-- > 0) {
diff --git a/src/main/java/org/apache/commons/codec/digest/MurmurHash2.java
b/src/main/java/org/apache/commons/codec/digest/MurmurHash2.java
index fbecba00..8174d6f8 100644
--- a/src/main/java/org/apache/commons/codec/digest/MurmurHash2.java
+++ b/src/main/java/org/apache/commons/codec/digest/MurmurHash2.java
@@ -79,7 +79,7 @@ public final class MurmurHash2 {
// body
for (int i = 0; i < nblocks; i++) {
- final int index = (i << 2);
+ final int index = i << 2;
int k = getLittleEndianInt(data, index);
k *= M32;
k ^= k >>> R32;
@@ -89,14 +89,14 @@ public final class MurmurHash2 {
}
// Handle the last few bytes of the input array
- final int index = (nblocks << 2);
+ final int index = nblocks << 2;
switch (length - index) {
case 3:
h ^= (data[index + 2] & 0xff) << 16;
case 2:
h ^= (data[index + 1] & 0xff) << 8;
case 1:
- h ^= (data[index] & 0xff);
+ h ^= data[index] & 0xff;
h *= M32;
}
@@ -180,13 +180,13 @@ public final class MurmurHash2 {
* @return The 64-bit hash of the given array
*/
public static long hash64(final byte[] data, final int length, final int
seed) {
- long h = (seed & 0xffffffffL) ^ (length * M64);
+ long h = seed & 0xffffffffL ^ length * M64;
final int nblocks = length >> 3;
// body
for (int i = 0; i < nblocks; i++) {
- final int index = (i << 3);
+ final int index = i << 3;
long k = getLittleEndianLong(data, index);
k *= M64;
@@ -197,7 +197,7 @@ public final class MurmurHash2 {
h *= M64;
}
- final int index = (nblocks << 3);
+ final int index = nblocks << 3;
switch (length - index) {
case 7:
h ^= ((long) data[index + 6] & 0xff) << 48;
@@ -212,7 +212,7 @@ public final class MurmurHash2 {
case 2:
h ^= ((long) data[index + 1] & 0xff) << 8;
case 1:
- h ^= ((long) data[index] & 0xff);
+ h ^= (long) data[index] & 0xff;
h *= M64;
}
@@ -295,10 +295,10 @@ public final class MurmurHash2 {
* @return The little-endian int
*/
private static int getLittleEndianInt(final byte[] data, final int index) {
- return ((data[index ] & 0xff) ) |
- ((data[index + 1] & 0xff) << 8) |
- ((data[index + 2] & 0xff) << 16) |
- ((data[index + 3] & 0xff) << 24);
+ return data[index ] & 0xff |
+ (data[index + 1] & 0xff) << 8 |
+ (data[index + 2] & 0xff) << 16 |
+ (data[index + 3] & 0xff) << 24;
}
/**
@@ -309,13 +309,13 @@ public final class MurmurHash2 {
* @return The little-endian long
*/
private static long getLittleEndianLong(final byte[] data, final int
index) {
- return (((long) data[index ] & 0xff) ) |
- (((long) data[index + 1] & 0xff) << 8) |
- (((long) data[index + 2] & 0xff) << 16) |
- (((long) data[index + 3] & 0xff) << 24) |
- (((long) data[index + 4] & 0xff) << 32) |
- (((long) data[index + 5] & 0xff) << 40) |
- (((long) data[index + 6] & 0xff) << 48) |
- (((long) data[index + 7] & 0xff) << 56);
+ return (long) data[index ] & 0xff |
+ ((long) data[index + 1] & 0xff) << 8 |
+ ((long) data[index + 2] & 0xff) << 16 |
+ ((long) data[index + 3] & 0xff) << 24 |
+ ((long) data[index + 4] & 0xff) << 32 |
+ ((long) data[index + 5] & 0xff) << 40 |
+ ((long) data[index + 6] & 0xff) << 48 |
+ ((long) data[index + 7] & 0xff) << 56;
}
}
diff --git a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
index 2291c512..24ca412a 100644
--- a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
+++ b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
@@ -140,7 +140,7 @@ public final class MurmurHash3 {
hash = mix32((int) r0, hash);
hash = mix32((int) (r0 >>> 32), hash);
- hash = mix32((int) (r1), hash);
+ hash = mix32((int) r1, hash);
hash = mix32((int) (r1 >>> 32), hash);
hash ^= Long.BYTES * 2;
@@ -405,7 +405,7 @@ public final class MurmurHash3 {
case 2:
k1 ^= (data[index + 1] & 0xff) << 8;
case 1:
- k1 ^= (data[index] & 0xff);
+ k1 ^= data[index] & 0xff;
// mix functions
k1 *= C1_32;
@@ -494,7 +494,7 @@ public final class MurmurHash3 {
*/
@Deprecated
public static long hash64(final int data) {
- long k1 = Integer.reverseBytes(data) & (-1L >>> 32);
+ long k1 = Integer.reverseBytes(data) & -1L >>> 32;
long hash = DEFAULT_SEED;
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
@@ -540,7 +540,7 @@ public final class MurmurHash3 {
long hash = DEFAULT_SEED;
long k1 = 0;
k1 ^= ((long) data & 0xff) << 8;
- k1 ^= ((long) ((data & 0xFF00) >> 8) & 0xff);
+ k1 ^= (long) ((data & 0xFF00) >> 8) & 0xff;
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
k1 *= C2;
@@ -683,7 +683,7 @@ public final class MurmurHash3 {
case 2:
k1 ^= ((long) data[index + 1] & 0xff) << 8;
case 1:
- k1 ^= ((long) data[index] & 0xff);
+ k1 ^= (long) data[index] & 0xff;
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
k1 *= C2;
@@ -926,14 +926,14 @@ public final class MurmurHash3 {
* @return The little-endian long
*/
private static long getLittleEndianLong(final byte[] data, final int
index) {
- return (((long) data[index ] & 0xff) ) |
- (((long) data[index + 1] & 0xff) << 8) |
- (((long) data[index + 2] & 0xff) << 16) |
- (((long) data[index + 3] & 0xff) << 24) |
- (((long) data[index + 4] & 0xff) << 32) |
- (((long) data[index + 5] & 0xff) << 40) |
- (((long) data[index + 6] & 0xff) << 48) |
- (((long) data[index + 7] & 0xff) << 56);
+ return (long) data[index ] & 0xff |
+ ((long) data[index + 1] & 0xff) << 8 |
+ ((long) data[index + 2] & 0xff) << 16 |
+ ((long) data[index + 3] & 0xff) << 24 |
+ ((long) data[index + 4] & 0xff) << 32 |
+ ((long) data[index + 5] & 0xff) << 40 |
+ ((long) data[index + 6] & 0xff) << 48 |
+ ((long) data[index + 7] & 0xff) << 56;
}
/**
@@ -944,10 +944,10 @@ public final class MurmurHash3 {
* @return The little-endian int
*/
private static int getLittleEndianInt(final byte[] data, final int index) {
- return ((data[index ] & 0xff) ) |
- ((data[index + 1] & 0xff) << 8) |
- ((data[index + 2] & 0xff) << 16) |
- ((data[index + 3] & 0xff) << 24);
+ return data[index ] & 0xff |
+ (data[index + 1] & 0xff) << 8 |
+ (data[index + 2] & 0xff) << 16 |
+ (data[index + 3] & 0xff) << 24;
}
/**
@@ -972,11 +972,11 @@ public final class MurmurHash3 {
* @return The final hash
*/
private static int fmix32(int hash) {
- hash ^= (hash >>> 16);
+ hash ^= hash >>> 16;
hash *= 0x85ebca6b;
- hash ^= (hash >>> 13);
+ hash ^= hash >>> 13;
hash *= 0xc2b2ae35;
- hash ^= (hash >>> 16);
+ hash ^= hash >>> 16;
return hash;
}
@@ -987,11 +987,11 @@ public final class MurmurHash3 {
* @return The final hash
*/
private static long fmix64(long hash) {
- hash ^= (hash >>> 33);
+ hash ^= hash >>> 33;
hash *= 0xff51afd7ed558ccdL;
- hash ^= (hash >>> 33);
+ hash ^= hash >>> 33;
hash *= 0xc4ceb9fe1a85ec53L;
- hash ^= (hash >>> 33);
+ hash ^= hash >>> 33;
return hash;
}
@@ -1106,7 +1106,7 @@ public final class MurmurHash3 {
}
// Save left-over unprocessed bytes
- final int consumed = (nblocks << 2);
+ final int consumed = nblocks << 2;
unprocessedLength = newLength - consumed;
if (unprocessedLength != 0) {
System.arraycopy(data, newOffset + consumed, unprocessed, 0,
unprocessedLength);
@@ -1143,7 +1143,7 @@ public final class MurmurHash3 {
case 2:
k1 ^= (unprocessed[1] & 0xff) << 8;
case 1:
- k1 ^= (unprocessed[0] & 0xff);
+ k1 ^= unprocessed[0] & 0xff;
// mix functions
k1 *= C1_32;
@@ -1169,7 +1169,7 @@ public final class MurmurHash3 {
* @return The 32-bit integer
*/
private static int orBytes(final byte b1, final byte b2, final byte
b3, final byte b4) {
- return (b1 & 0xff) | ((b2 & 0xff) << 8) | ((b3 & 0xff) << 16) |
((b4 & 0xff) << 24);
+ return b1 & 0xff | (b2 & 0xff) << 8 | (b3 & 0xff) << 16 | (b4 &
0xff) << 24;
}
}
diff --git a/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32.java
b/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32.java
index f2206c01..5958f1dc 100644
--- a/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32.java
+++ b/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32.java
@@ -582,7 +582,7 @@ public class PureJavaCrc32 implements Checksum {
@Override
public long getValue() {
- return (~crc) & 0xffffffffL;
+ return ~crc & 0xffffffffL;
}
@Override
@@ -603,24 +603,24 @@ public class PureJavaCrc32 implements Checksum {
int i = offset;
for(final int end = offset + len - remainder; i < end; i += 8) {
final int x = localCrc ^
- ((((b[i ] << 24) >>> 24) + ((b[i+1] << 24) >>> 16)) +
- (((b[i+2] << 24) >>> 8 ) + (b[i+3] << 24)));
+ (b[i ] << 24 >>> 24) + (b[i+1] << 24 >>> 16) +
+ (b[i+2] << 24 >>> 8 ) + (b[i+3] << 24);
- localCrc = ((T[((x << 24) >>> 24) + 0x700] ^ T[((x << 16) >>> 24) +
0x600]) ^
- (T[((x << 8) >>> 24) + 0x500] ^ T[ (x >>> 24) +
0x400])) ^
- ((T[((b[i+4] << 24) >>> 24) + 0x300] ^ T[((b[i+5] << 24) >>>
24) + 0x200]) ^
- (T[((b[i+6] << 24) >>> 24) + 0x100] ^ T[((b[i+7] << 24) >>>
24)]));
+ localCrc = T[(x << 24 >>> 24) + 0x700] ^ T[(x << 16 >>> 24) + 0x600] ^
+ T[(x << 8 >>> 24) + 0x500] ^ T[ (x >>> 24) + 0x400] ^
+ T[(b[i+4] << 24 >>> 24) + 0x300] ^ T[(b[i+5] << 24 >>> 24) +
0x200] ^
+ T[(b[i+6] << 24 >>> 24) + 0x100] ^ T[b[i+7] << 24 >>> 24];
}
/* loop unroll - duff's device style */
switch(remainder) {
- case 7: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 6: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 5: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 4: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 3: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 2: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
- case 1: localCrc = (localCrc >>> 8) ^ T[((localCrc ^ b[i++]) << 24) >>>
24];
+ case 7: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 6: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 5: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 4: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 3: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 2: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
+ case 1: localCrc = localCrc >>> 8 ^ T[(localCrc ^ b[i++]) << 24 >>> 24];
default:
/* nothing */
}
@@ -631,7 +631,7 @@ public class PureJavaCrc32 implements Checksum {
@Override
final public void update(final int b) {
- crc = (crc >>> 8) ^ T[(((crc ^ b) << 24) >>> 24)];
+ crc = crc >>> 8 ^ T[(crc ^ b) << 24 >>> 24];
}
}
diff --git a/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32C.java
b/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32C.java
index 27d14c71..2b57e896 100644
--- a/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32C.java
+++ b/src/main/java/org/apache/commons/codec/digest/PureJavaCrc32C.java
@@ -588,7 +588,7 @@ public class PureJavaCrc32C implements Checksum {
@Override
public long getValue() {
final long ret = crc;
- return (~ret) & 0xffffffffL;
+ return ~ret & 0xffffffffL;
}
@Override
@@ -605,16 +605,16 @@ public class PureJavaCrc32C implements Checksum {
final int c1 =(b[off+1] ^ (localCrc >>>= 8)) & 0xff;
final int c2 =(b[off+2] ^ (localCrc >>>= 8)) & 0xff;
final int c3 =(b[off+3] ^ (localCrc >>>= 8)) & 0xff;
- localCrc = (T[T8_7_START + c0] ^ T[T8_6_START + c1]) ^
- (T[T8_5_START + c2] ^ T[T8_4_START + c3]);
+ localCrc = T[T8_7_START + c0] ^ T[T8_6_START + c1] ^
+ T[T8_5_START + c2] ^ T[T8_4_START + c3];
final int c4 = b[off+4] & 0xff;
final int c5 = b[off+5] & 0xff;
final int c6 = b[off+6] & 0xff;
final int c7 = b[off+7] & 0xff;
- localCrc ^= (T[T8_3_START + c4] ^ T[T8_2_START + c5]) ^
- (T[T8_1_START + c6] ^ T[T8_0_START + c7]);
+ localCrc ^= T[T8_3_START + c4] ^ T[T8_2_START + c5] ^
+ T[T8_1_START + c6] ^ T[T8_0_START + c7];
off += 8;
len -= 8;
@@ -622,13 +622,13 @@ public class PureJavaCrc32C implements Checksum {
/* loop unroll - duff's device style */
switch(len) {
- case 7: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 6: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 5: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 4: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 3: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 2: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
- case 1: localCrc = (localCrc >>> 8) ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 7: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 6: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 5: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 4: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 3: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 2: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
+ case 1: localCrc = localCrc >>> 8 ^ T[T8_0_START + ((localCrc ^
b[off++]) & 0xff)];
default:
break; // satisfy Findbugs
}
@@ -639,7 +639,7 @@ public class PureJavaCrc32C implements Checksum {
@Override
final public void update(final int b) {
- crc = (crc >>> 8) ^ T[T8_0_START + ((crc ^ b) & 0xff)];
+ crc = crc >>> 8 ^ T[T8_0_START + ((crc ^ b) & 0xff)];
}
}
diff --git a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
b/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
index 94a3ea9b..a7bad57b 100644
--- a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
+++ b/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
@@ -383,7 +383,7 @@ public class UnixCrypt {
SKB[3][c >>> 20 & 0x1 | c >>> 21 & 0x6 | c >>> 22 & 0x38];
final int t = SKB[4][d & 0x3f] | SKB[5][d >>> 7 & 0x3 | d >>> 8 &
0x3c] | SKB[6][d >>> 15 & 0x3f] |
SKB[7][d >>> 21 & 0xf | d >>> 22 & 0x30];
- schedule[j++] = (t << 16 | s & 0xffff);
+ schedule[j++] = t << 16 | s & 0xffff;
s = s >>> 16 | t & 0xffff0000;
s = s << 4 | s >>> 28;
schedule[j++] = s;
diff --git a/src/main/java/org/apache/commons/codec/digest/XXHash32.java
b/src/main/java/org/apache/commons/codec/digest/XXHash32.java
index 85afad92..c11d3638 100644
--- a/src/main/java/org/apache/commons/codec/digest/XXHash32.java
+++ b/src/main/java/org/apache/commons/codec/digest/XXHash32.java
@@ -171,10 +171,10 @@ public class XXHash32 implements Checksum {
* @return The little-endian int
*/
private static int getInt(final byte[] buffer, final int idx) {
- return ((buffer[idx ] & 0xff) ) |
- ((buffer[idx + 1] & 0xff) << 8) |
- ((buffer[idx + 2] & 0xff) << 16) |
- ((buffer[idx + 3] & 0xff) << 24);
+ return buffer[idx ] & 0xff |
+ (buffer[idx + 1] & 0xff) << 8 |
+ (buffer[idx + 2] & 0xff) << 16 |
+ (buffer[idx + 3] & 0xff) << 24;
}
private void initializeState() {
diff --git
a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
index a1e43d09..bd1c59cf 100644
--- a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
+++ b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
@@ -342,7 +342,7 @@ public class ColognePhonetic implements StringEncoder {
if (arrayContains(AEIJOUY, chr)) {
output.put('0');
- } else if (chr == 'B' || (chr == 'P' && nextChar != 'H')) {
+ } else if (chr == 'B' || chr == 'P' && nextChar != 'H') {
output.put('1');
} else if ((chr == 'D' || chr == 'T') && !arrayContains(CSZ,
nextChar)) {
output.put('2');
diff --git
a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
index f45bd507..96390df4 100644
--- a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
+++ b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
@@ -505,7 +505,7 @@ public class DaitchMokotoffSoundex implements StringEncoder
{
final Branch nextBranch = branchingRequired ?
branch.createBranch() : branch;
// special rule: occurrences of mn or nm are
treated differently
- final boolean force = (lastChar == 'm' && ch ==
'n') || (lastChar == 'n' && ch == 'm');
+ final boolean force = lastChar == 'm' && ch == 'n'
|| lastChar == 'n' && ch == 'm';
nextBranch.processNextReplacement(nextReplacement,
force);
diff --git
a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 6b363fab..4c11b2cb 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -324,7 +324,7 @@ public class DoubleMetaphone implements StringEncoder {
if (contains(value, index + 2, 1, "I", "E", "H") &&
!contains(value, index + 2, 2, "HU")) {
//-- "bellocchio" but not "bacchus" --//
- if ((index == 1 && charAt(value, index - 1) == 'A') ||
+ if (index == 1 && charAt(value, index - 1) == 'A' ||
contains(value, index - 1, 5, "UCCEE", "UCCES")) {
//-- "accident", "accede", "succeed" --//
result.append("KS");
@@ -443,11 +443,12 @@ public class DoubleMetaphone implements StringEncoder {
result.append('J', 'K');
}
index += 2;
- } else if (charAt(value, index + 1) == 'G') {
- index += 2;
- result.append('K');
} else {
- index++;
+ if (charAt(value, index + 1) == 'G') {
+ index += 2;
+ } else {
+ index++;
+ }
result.append('K');
}
return index;
@@ -459,7 +460,6 @@ public class DoubleMetaphone implements StringEncoder {
private int handleGH(final String value, final DoubleMetaphoneResult
result, int index) {
if (index > 0 && !isVowel(charAt(value, index - 1))) {
result.append('K');
- index += 2;
} else if (index == 0) {
if (charAt(value, index + 2) == 'I') {
result.append('J');
@@ -467,9 +467,9 @@ public class DoubleMetaphone implements StringEncoder {
result.append('K');
}
index += 2;
- } else if ((index > 1 && contains(value, index - 2, 1, "B", "H", "D"))
||
- (index > 2 && contains(value, index - 3, 1, "B", "H", "D"))
||
- (index > 3 && contains(value, index - 4, 1, "B", "H"))) {
+ } else if (index > 1 && contains(value, index - 2, 1, "B", "H", "D") ||
+ index > 2 && contains(value, index - 3, 1, "B", "H", "D") ||
+ index > 3 && contains(value, index - 4, 1, "B", "H")) {
//-- Parker's rule (with some further refinements) - "hugh"
index += 2;
} else {
@@ -508,8 +508,8 @@ public class DoubleMetaphone implements StringEncoder {
final boolean slavoGermanic) {
if (contains(value, index, 4, "JOSE") || contains(value, 0, 4, "SAN
")) {
//-- obvious Spanish, "Jose", "San Jacinto" --//
- if ((index == 0 && (charAt(value, index + 4) == ' ') ||
- value.length() == 4) || contains(value, 0, 4, "SAN ")) {
+ if (index == 0 && charAt(value, index + 4) == ' ' ||
+ value.length() == 4 || contains(value, 0, 4, "SAN ")) {
result.append('H');
} else {
result.append('J', 'H');
@@ -612,7 +612,7 @@ public class DoubleMetaphone implements StringEncoder {
result.append('S', 'X');
}
index += 3;
- } else if ((index == 0 && contains(value, index + 1, 1, "M", "N", "L",
"W")) ||
+ } else if (index == 0 && contains(value, index + 1, 1, "M", "N", "L",
"W") ||
contains(value, index + 1, 1, "Z")) {
//-- german & anglicisations, e.g. "smith" match "schmidt" //
// "snider" match "schneider" --//
@@ -703,7 +703,7 @@ public class DoubleMetaphone implements StringEncoder {
result.append('A');
}
index++;
- } else if ((index == value.length() - 1 && isVowel(charAt(value, index
- 1))) ||
+ } else if (index == value.length() - 1 && isVowel(charAt(value, index
- 1)) ||
contains(value, index - 1, 5, "EWSKI", "EWSKY", "OWSKI",
"OWSKY") ||
contains(value, 0, 3, "SCH")) {
//-- Arnow should match Arnoff --//
@@ -727,7 +727,7 @@ public class DoubleMetaphone implements StringEncoder {
result.append('S');
index++;
} else {
- if (!((index == value.length() - 1) &&
+ if (!(index == value.length() - 1 &&
(contains(value, index - 3, 3, "IAU", "EAU") ||
contains(value, index - 2, 2, "AU", "OU")))) {
//-- French e.g. breaux --//
@@ -749,7 +749,7 @@ public class DoubleMetaphone implements StringEncoder {
index += 2;
} else {
if (contains(value, index + 1, 2, "ZO", "ZI", "ZA") ||
- (slavoGermanic && (index > 0 && charAt(value, index - 1) !=
'T'))) {
+ slavoGermanic && index > 0 && charAt(value, index - 1) != 'T')
{
result.append("S", "TS");
} else {
result.append('S');
@@ -778,7 +778,7 @@ public class DoubleMetaphone implements StringEncoder {
return false;
}
final char c = charAt(value, index + 2);
- return (c != 'I' && c != 'E') ||
+ return c != 'I' && c != 'E' ||
contains(value, index - 2, 6, "BACHER", "MACHER");
}
@@ -800,11 +800,11 @@ public class DoubleMetaphone implements StringEncoder {
* Complex condition 1 for 'CH'.
*/
private boolean conditionCH1(final String value, final int index) {
- return ((contains(value, 0, 4, "VAN ", "VON ") || contains(value, 0,
3, "SCH")) ||
+ return contains(value, 0, 4, "VAN ", "VON ") || contains(value, 0, 3,
"SCH") ||
contains(value, index - 2, 6, "ORCHES", "ARCHIT", "ORCHID") ||
contains(value, index + 2, 1, "T", "S") ||
- ((contains(value, index - 1, 1, "A", "O", "U", "E") || index
== 0) &&
- (contains(value, index + 2, 1, L_R_N_M_B_H_F_V_W_SPACE) ||
index + 1 == value.length() - 1)));
+ (contains(value, index - 1, 1, "A", "O", "U", "E") || index ==
0) &&
+ (contains(value, index + 2, 1, L_R_N_M_B_H_F_V_W_SPACE) ||
index + 1 == value.length() - 1);
}
/**
@@ -828,7 +828,7 @@ public class DoubleMetaphone implements StringEncoder {
return true;
}
return contains(value, index - 1, 3, "UMB") &&
- ((index + 1) == value.length() - 1 || contains(value, index +
2, 2, "ER"));
+ (index + 1 == value.length() - 1 || contains(value, index + 2,
2, "ER"));
}
//-- BEGIN HELPER FUNCTIONS --//
diff --git a/src/main/java/org/apache/commons/codec/language/Soundex.java
b/src/main/java/org/apache/commons/codec/language/Soundex.java
index b26831de..8905555d 100644
--- a/src/main/java/org/apache/commons/codec/language/Soundex.java
+++ b/src/main/java/org/apache/commons/codec/language/Soundex.java
@@ -325,7 +325,7 @@ public class Soundex implements StringEncoder {
char lastDigit = map(first); // previous digit
for(int i = 1; i < str.length() && count < out.length ; i++) {
final char ch = str.charAt(i);
- if ((this.specialCaseHW) && (ch == 'H' || ch == 'W')) { // these
are ignored completely
+ if (this.specialCaseHW && (ch == 'H' || ch == 'W')) { // these are
ignored completely
continue;
}
final char digit = map(ch);
diff --git a/src/main/java/org/apache/commons/codec/net/PercentCodec.java
b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
index b33dddd8..31288642 100644
--- a/src/main/java/org/apache/commons/codec/net/PercentCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
@@ -125,7 +125,7 @@ public class PercentCodec implements BinaryEncoder,
BinaryDecoder {
final int expectedEncodingBytes = expectedEncodingBytes(bytes);
final boolean willEncode = expectedEncodingBytes != bytes.length;
- if (willEncode || (plusForSpace && containsSpace(bytes))) {
+ if (willEncode || plusForSpace && containsSpace(bytes)) {
return doEncode(bytes, expectedEncodingBytes, willEncode);
}
return bytes;
@@ -171,7 +171,7 @@ public class PercentCodec implements BinaryEncoder,
BinaryDecoder {
}
private boolean canEncode(final byte c) {
- return !isAsciiChar(c) || (inAlwaysEncodeCharsRange(c) &&
alwaysEncodeChars.get(c));
+ return !isAsciiChar(c) || inAlwaysEncodeCharsRange(c) &&
alwaysEncodeChars.get(c);
}
private boolean inAlwaysEncodeCharsRange(final byte c) {
diff --git
a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
index 43176b7c..51487161 100644
--- a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
@@ -310,7 +310,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
// rule #3: whitespace at the end of a line *must* be encoded
// if we would do a soft break line after this octet, encode
whitespace
int b = getUnsignedOctet(bytesLength - 3, bytes);
- boolean encode = !printable.get(b) || (isWhitespace(b) && pos >
SAFE_LENGTH - 5);
+ boolean encode = !printable.get(b) || isWhitespace(b) && pos >
SAFE_LENGTH - 5;
pos += encodeByte(b, encode, buffer);
// note #3: '=' *must not* be the ultimate or penultimate character
@@ -324,7 +324,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
for (int i = bytesLength - 2; i < bytesLength; i++) {
b = getUnsignedOctet(i, bytes);
// rule #3: trailing whitespace shall be encoded
- encode = !printable.get(b) || (i > bytesLength - 2 &&
isWhitespace(b));
+ encode = !printable.get(b) || i > bytesLength - 2 &&
isWhitespace(b);
encodeByte(b, encode, buffer);
}
} else {
diff --git a/src/test/java/org/apache/commons/codec/binary/Base32Test.java
b/src/test/java/org/apache/commons/codec/binary/Base32Test.java
index b752a20c..d0c892c2 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base32Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base32Test.java
@@ -306,8 +306,8 @@ public class Base32Test {
for (char c = 'a'; c <= 'z'; c++) {
assertTrue(b32.isInAlphabet((byte) c));
}
- assertFalse(b32.isInAlphabet((byte) ('1')));
- assertFalse(b32.isInAlphabet((byte) ('8')));
+ assertFalse(b32.isInAlphabet((byte) '1'));
+ assertFalse(b32.isInAlphabet((byte) '8'));
assertFalse(b32.isInAlphabet((byte) ('A' - 1)));
assertFalse(b32.isInAlphabet((byte) ('Z' + 1)));
diff --git
a/src/test/java/org/apache/commons/codec/binary/Base64InputStreamTest.java
b/src/test/java/org/apache/commons/codec/binary/Base64InputStreamTest.java
index 06622eb1..422be5bb 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base64InputStreamTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base64InputStreamTest.java
@@ -297,7 +297,7 @@ public class Base64InputStreamTest {
private void testByChunk(final byte[] encoded, final byte[] decoded, final
int chunkSize, final byte[] separator) throws Exception {
// Start with encode.
try (InputStream in = new Base64InputStream(new
ByteArrayInputStream(decoded), true, chunkSize, separator)) {
- byte[] output = BaseNTestData.streamToBytes(in);
+ final byte[] output = BaseNTestData.streamToBytes(in);
assertEquals(-1, in.read(), "EOF");
assertEquals(-1, in.read(), "Still EOF");
assertArrayEquals(encoded, output, "Streaming base64 encode");
diff --git a/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
b/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
index ad3f25e2..9ac6d7e0 100644
--- a/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
+++ b/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
@@ -217,7 +217,7 @@ public class MurmurHash3Test {
final byte[] bytes = Arrays.copyOf(RANDOM_BYTES, i);
// Known bug: Incorrect result for non modulus of 4 byte arrays if
there are
// negative bytes
- if (i % 4 == 0 || !negativeBytes(bytes, (i / 4) * 4, i % 4)) {
+ if (i % 4 == 0 || !negativeBytes(bytes, i / 4 * 4, i % 4)) {
assertEquals(answers[i], MurmurHash3.hash32(bytes));
} else {
assertNotEquals(answers[i], MurmurHash3.hash32(bytes));
@@ -248,7 +248,7 @@ public class MurmurHash3Test {
for (int i = 0; i < answers.length; i++) {
// Known bug: Incorrect result for non modulus of 4 byte arrays if
there are
// negative bytes
- if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, (i / 4) * 4, i %
4)) {
+ if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, i / 4 * 4, i % 4)) {
assertEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES, i));
} else {
assertNotEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES,
i));
@@ -280,7 +280,7 @@ public class MurmurHash3Test {
for (int i = 0; i < answers.length; i++) {
// Known bug: Incorrect result for non modulus of 4 byte arrays if
there are
// negative bytes
- if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, (i / 4) * 4, i %
4)) {
+ if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, i / 4 * 4, i % 4)) {
assertEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES, i,
seed));
} else {
assertNotEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES,
i, seed));
@@ -311,7 +311,7 @@ public class MurmurHash3Test {
for (int i = 0; i < answers.length; i++) {
// Known bug: Incorrect result for non modulus of 4 byte arrays if
there are
// negative bytes
- if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, offset + (i / 4) *
4, i % 4)) {
+ if (i % 4 == 0 || !negativeBytes(RANDOM_BYTES, offset + i / 4 * 4,
i % 4)) {
assertEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES,
offset, i, seed));
} else {
assertNotEquals(answers[i], MurmurHash3.hash32(RANDOM_BYTES,
offset, i, seed));
diff --git
a/src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java
b/src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java
index 3f3df687..64765271 100644
--- a/src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java
+++ b/src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java
@@ -142,7 +142,7 @@ public class PureJavaCrc32Test {
final int[] previous = tables[j-1];
final int[] current = tables[j];
for (int i = 0; i < current.length; i++) {
- current[i] = (previous[i] >>> nBits) ^ first[previous[i] & mask];
+ current[i] = previous[i] >>> nBits ^ first[previous[i] & mask];
}
}
}
diff --git
a/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
b/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
index 7984830d..125ccb04 100644
---
a/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
+++
b/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
@@ -205,7 +205,7 @@ public class MatchRatingApproachEncoderTest extends
AbstractStringEncoderTest<Ma
@Test
public final void testIsVowel_SingleVowel_ReturnsTrue() {
- assertTrue(this.getStringEncoder().isVowel(("I")));
+ assertTrue(this.getStringEncoder().isVowel("I"));
}
@Test
diff --git a/src/test/java/org/apache/commons/codec/net/CustomRFC1522Codec.java
b/src/test/java/org/apache/commons/codec/net/CustomRFC1522Codec.java
index 6bee3040..43818fef 100644
--- a/src/test/java/org/apache/commons/codec/net/CustomRFC1522Codec.java
+++ b/src/test/java/org/apache/commons/codec/net/CustomRFC1522Codec.java
@@ -34,27 +34,27 @@ public class CustomRFC1522Codec extends RFC1522Codec {
}
@Override
- protected byte[] doEncoding(byte[] bytes) throws EncoderException {
+ protected byte[] doEncoding(final byte[] bytes) throws EncoderException {
return null;
}
@Override
- protected byte[] doDecoding(byte[] bytes) throws DecoderException {
+ protected byte[] doDecoding(final byte[] bytes) throws DecoderException {
return null;
}
@Override
- protected String encodeText(String text, Charset charset) throws
EncoderException {
+ protected String encodeText(final String text, final Charset charset)
throws EncoderException {
return super.encodeText(text, charset);
}
@Override
- protected String encodeText(String text, String charsetName) throws
EncoderException, UnsupportedEncodingException {
+ protected String encodeText(final String text, final String charsetName)
throws EncoderException, UnsupportedEncodingException {
return super.encodeText(text, charsetName);
}
@Override
- protected String decodeText(String text) throws DecoderException,
UnsupportedEncodingException {
+ protected String decodeText(final String text) throws DecoderException,
UnsupportedEncodingException {
return super.decodeText(text);
}