Skip to content

Commit ce44cfa

Browse files
committed
Add final modifier to method parameters
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1811344 13f79535-47bb-0310-9956-ffa450edef68
1 parent c8c94f9 commit ce44cfa

18 files changed

Lines changed: 54 additions & 54 deletions

src/main/java/org/apache/commons/codec/binary/BaseNCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public byte[] encode(final byte[] pArray) {
444444
* @return A byte array containing only the base N alphabetic character data
445445
* @since 1.11
446446
*/
447-
public byte[] encode(final byte[] pArray, int offset, int length) {
447+
public byte[] encode(final byte[] pArray, final int offset, final int length) {
448448
if (pArray == null || pArray.length == 0) {
449449
return pArray;
450450
}

src/main/java/org/apache/commons/codec/binary/Hex.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
7676
* Thrown if an odd number or illegal of characters is supplied
7777
* @since 1.11
7878
*/
79-
public static byte[] decodeHex(String data) throws DecoderException {
79+
public static byte[] decodeHex(final String data) throws DecoderException {
8080
return decodeHex(data.toCharArray());
8181
}
8282

@@ -237,7 +237,7 @@ public static String encodeHexString(final byte[] data) {
237237
* @return A String containing lower-case hexadecimal characters
238238
* @since 1.11
239239
*/
240-
public static String encodeHexString(final byte[] data, boolean toLowerCase) {
240+
public static String encodeHexString(final byte[] data, final boolean toLowerCase) {
241241
return new String(encodeHex(data, toLowerCase));
242242
}
243243

@@ -265,7 +265,7 @@ public static String encodeHexString(final ByteBuffer data) {
265265
* @return A String containing lower-case hexadecimal characters
266266
* @since 1.11
267267
*/
268-
public static String encodeHexString(final ByteBuffer data, boolean toLowerCase) {
268+
public static String encodeHexString(final ByteBuffer data, final boolean toLowerCase) {
269269
return new String(encodeHex(data, toLowerCase));
270270
}
271271

src/main/java/org/apache/commons/codec/cli/Digest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class Digest {
4949
* {@code args[1+]} is a FILE/DIRECTORY/String.
5050
* @throws IOException if an error occurs
5151
*/
52-
public static void main(String[] args) throws IOException {
52+
public static void main(final String[] args) throws IOException {
5353
new Digest(args).run();
5454
}
5555

@@ -79,7 +79,7 @@ private void println(final String prefix, final byte[] digest) {
7979
println(prefix, digest, null);
8080
}
8181

82-
private void println(final String prefix, final byte[] digest, String fileName) {
82+
private void println(final String prefix, final byte[] digest, final String fileName) {
8383
// The standard appears to be to print
8484
// hex, space, then either space or '*' followed by filename
8585
// where '*' is used for binary files
@@ -101,15 +101,15 @@ private void run() throws IOException {
101101
}
102102
}
103103

104-
private void run(String[] digestAlgorithms) throws IOException {
104+
private void run(final String[] digestAlgorithms) throws IOException {
105105
for (final String messageDigestAlgorithm : digestAlgorithms) {
106106
if (DigestUtils.isAvailable(messageDigestAlgorithm)) {
107107
run(messageDigestAlgorithm + " ", messageDigestAlgorithm);
108108
}
109109
}
110110
}
111111

112-
private void run(String prefix, final MessageDigest messageDigest) throws IOException {
112+
private void run(final String prefix, final MessageDigest messageDigest) throws IOException {
113113
if (inputs == null) {
114114
println(prefix, DigestUtils.digest(messageDigest, System.in));
115115
return;
@@ -131,15 +131,15 @@ private void run(String prefix, final MessageDigest messageDigest) throws IOExce
131131
}
132132
}
133133

134-
private void run(String prefix, MessageDigest messageDigest, File[] files) throws IOException {
134+
private void run(final String prefix, final MessageDigest messageDigest, final File[] files) throws IOException {
135135
for (final File file : files) {
136136
if (file.isFile()) {
137137
println(prefix, DigestUtils.digest(messageDigest, file), file.getName());
138138
}
139139
}
140140
}
141141

142-
private void run(String prefix, final String messageDigestAlgorithm) throws IOException {
142+
private void run(final String prefix, final String messageDigestAlgorithm) throws IOException {
143143
run(prefix, DigestUtils.getDigest(messageDigestAlgorithm));
144144
}
145145

src/main/java/org/apache/commons/codec/digest/DigestUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static MessageDigest getDigest(final String algorithm) {
154154
* when a {@link NoSuchAlgorithmException} is caught.
155155
* @since 1.11
156156
*/
157-
public static MessageDigest getDigest(final String algorithm, MessageDigest defaultMessageDigest) {
157+
public static MessageDigest getDigest(final String algorithm, final MessageDigest defaultMessageDigest) {
158158
try {
159159
return MessageDigest.getInstance(algorithm);
160160
} catch (final Exception e) {
@@ -955,7 +955,7 @@ public static MessageDigest updateDigest(final MessageDigest messageDigest, fina
955955
* @return {@code true} if the algorithm can be found
956956
* @since 1.11
957957
*/
958-
public static boolean isAvailable(String messageDigestAlgorithm) {
958+
public static boolean isAvailable(final String messageDigestAlgorithm) {
959959
return getDigest(messageDigestAlgorithm, null) != null;
960960
}
961961

@@ -980,7 +980,7 @@ public DigestUtils() {
980980
* @param digest the {@link MessageDigest} to use
981981
* @since 1.11
982982
*/
983-
public DigestUtils(MessageDigest digest) {
983+
public DigestUtils(final MessageDigest digest) {
984984
this.messageDigest = digest;
985985
}
986986

@@ -996,7 +996,7 @@ public DigestUtils(MessageDigest digest) {
996996
* when a {@link NoSuchAlgorithmException} is caught.
997997
* @since 1.11
998998
*/
999-
public DigestUtils(String name) {
999+
public DigestUtils(final String name) {
10001000
this(getDigest(name));
10011001
}
10021002

src/main/java/org/apache/commons/codec/digest/HmacUtils.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public final class HmacUtils {
6565
* @return whether this algorithm is available
6666
* @since 1.11
6767
*/
68-
public static boolean isAvailable(String name) {
68+
public static boolean isAvailable(final String name) {
6969
try {
7070
Mac.getInstance(name);
7171
return true;
@@ -81,7 +81,7 @@ public static boolean isAvailable(String name) {
8181
* @return whether this algorithm is available
8282
* @since 1.11
8383
*/
84-
public static boolean isAvailable(HmacAlgorithms name) {
84+
public static boolean isAvailable(final HmacAlgorithms name) {
8585
try {
8686
Mac.getInstance(name.getName());
8787
return true;
@@ -954,7 +954,7 @@ public HmacUtils(final HmacAlgorithms algorithm, final byte[] key) {
954954
* @return the digest as a byte[]
955955
* @since 1.11
956956
*/
957-
public byte[] hmac(byte[] valueToDigest) {
957+
public byte[] hmac(final byte[] valueToDigest) {
958958
return mac.doFinal(valueToDigest);
959959
}
960960

@@ -965,7 +965,7 @@ public byte[] hmac(byte[] valueToDigest) {
965965
* @return the digest as a hex String
966966
* @since 1.11
967967
*/
968-
public String hmacHex(byte[] valueToDigest) {
968+
public String hmacHex(final byte[] valueToDigest) {
969969
return Hex.encodeHexString(hmac(valueToDigest));
970970
}
971971

@@ -976,7 +976,7 @@ public String hmacHex(byte[] valueToDigest) {
976976
* @return the digest as a byte[]
977977
* @since 1.11
978978
*/
979-
public byte[] hmac(String valueToDigest) {
979+
public byte[] hmac(final String valueToDigest) {
980980
return mac.doFinal(StringUtils.getBytesUtf8(valueToDigest));
981981
}
982982

@@ -987,7 +987,7 @@ public byte[] hmac(String valueToDigest) {
987987
* @return the digest as a hex String
988988
* @since 1.11
989989
*/
990-
public String hmacHex(String valueToDigest) {
990+
public String hmacHex(final String valueToDigest) {
991991
return Hex.encodeHexString(hmac(valueToDigest));
992992
}
993993

@@ -998,7 +998,7 @@ public String hmacHex(String valueToDigest) {
998998
* @return the digest as a byte[]
999999
* @since 1.11
10001000
*/
1001-
public byte[] hmac(ByteBuffer valueToDigest) {
1001+
public byte[] hmac(final ByteBuffer valueToDigest) {
10021002
mac.update(valueToDigest);
10031003
return mac.doFinal();
10041004
}
@@ -1010,7 +1010,7 @@ public byte[] hmac(ByteBuffer valueToDigest) {
10101010
* @return the digest as a hex String
10111011
* @since 1.11
10121012
*/
1013-
public String hmacHex(ByteBuffer valueToDigest) {
1013+
public String hmacHex(final ByteBuffer valueToDigest) {
10141014
return Hex.encodeHexString(hmac(valueToDigest));
10151015
}
10161016

@@ -1027,7 +1027,7 @@ public String hmacHex(ByteBuffer valueToDigest) {
10271027
* If an I/O error occurs.
10281028
* @since 1.11
10291029
*/
1030-
public byte[] hmac(InputStream valueToDigest) throws IOException {
1030+
public byte[] hmac(final InputStream valueToDigest) throws IOException {
10311031
final byte[] buffer = new byte[STREAM_BUFFER_LENGTH];
10321032
int read;
10331033

@@ -1050,7 +1050,7 @@ public byte[] hmac(InputStream valueToDigest) throws IOException {
10501050
* If an I/O error occurs.
10511051
* @since 1.11
10521052
*/
1053-
public String hmacHex(InputStream valueToDigest) throws IOException {
1053+
public String hmacHex(final InputStream valueToDigest) throws IOException {
10541054
return Hex.encodeHexString(hmac(valueToDigest));
10551055
}
10561056

@@ -1081,7 +1081,7 @@ public byte[] hmac(final File valueToDigest) throws IOException {
10811081
* If an I/O error occurs.
10821082
* @since 1.11
10831083
*/
1084-
public String hmacHex(File valueToDigest) throws IOException {
1084+
public String hmacHex(final File valueToDigest) throws IOException {
10851085
return Hex.encodeHexString(hmac(valueToDigest));
10861086
}
10871087

src/main/java/org/apache/commons/codec/digest/PureJavaCrc32.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void update(final byte[] b, final int offset, final int len) {
9999
}
100100

101101
@Override
102-
final public void update(int b) {
102+
final public void update(final int b) {
103103
crc = (crc >>> 8) ^ T[(((crc ^ b) << 24) >>> 24)];
104104
}
105105

src/main/java/org/apache/commons/codec/digest/PureJavaCrc32C.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void reset() {
5757
}
5858

5959
@Override
60-
public void update(byte[] b, int off, int len) {
60+
public void update(final byte[] b, int off, int len) {
6161
int localCrc = crc;
6262

6363
while(len > 7) {
@@ -98,7 +98,7 @@ public void update(byte[] b, int off, int len) {
9898
}
9999

100100
@Override
101-
final public void update(int b) {
101+
final public void update(final int b) {
102102
crc = (crc >>> 8) ^ T[T8_0_start + ((crc ^ b) & 0xff)];
103103
}
104104

src/main/java/org/apache/commons/codec/digest/XXHash32.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public XXHash32() {
6464
* Creates an XXHash32 instance.
6565
* @param seed the seed to use
6666
*/
67-
public XXHash32(int seed) {
67+
public XXHash32(final int seed) {
6868
this.seed = seed;
6969
initializeState();
7070
}
@@ -77,13 +77,13 @@ public void reset() {
7777
}
7878

7979
@Override
80-
public void update(int b) {
80+
public void update(final int b) {
8181
oneByte[0] = (byte) (b & 0xff);
8282
update(oneByte, 0, 1);
8383
}
8484

8585
@Override
86-
public void update(byte[] b, int off, final int len) {
86+
public void update(final byte[] b, int off, final int len) {
8787
if (len <= 0) {
8888
return;
8989
}
@@ -147,7 +147,7 @@ public long getValue() {
147147
return hash & 0xffffffffl;
148148
}
149149

150-
private static int getInt(byte[] buffer, int idx) {
150+
private static int getInt(final byte[] buffer, final int idx) {
151151
return (int) (fromLittleEndian(buffer, idx, 4) & 0xffffffffl);
152152
}
153153

@@ -158,7 +158,7 @@ private void initializeState() {
158158
state[3] = seed - PRIME1;
159159
}
160160

161-
private void process(byte[] b, int offset) {
161+
private void process(final byte[] b, final int offset) {
162162
// local shadows for performance
163163
int s0 = state[0];
164164
int s1 = state[1];
@@ -186,7 +186,7 @@ private void process(byte[] b, int offset) {
186186
* @return the number read
187187
* @throws IllegalArgumentException if len is bigger than eight
188188
*/
189-
private static long fromLittleEndian(byte[] bytes, final int off, final int length) {
189+
private static long fromLittleEndian(final byte[] bytes, final int off, final int length) {
190190
if (length > 8) {
191191
throw new IllegalArgumentException("can't read more than eight bytes into a long value");
192192
}

src/main/java/org/apache/commons/codec/language/Soundex.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public Soundex(final char[] mapping) {
159159
this.specialCaseHW = !hasMarker(this.soundexMapping);
160160
}
161161

162-
private boolean hasMarker(char[] mapping) {
162+
private boolean hasMarker(final char[] mapping) {
163163
for(final char ch : mapping) {
164164
if (ch == SILENT_MARKER) {
165165
return true;
@@ -192,7 +192,7 @@ public Soundex(final String mapping) {
192192
* @param specialCaseHW if true, then
193193
* @since 1.11
194194
*/
195-
public Soundex(final String mapping, boolean specialCaseHW) {
195+
public Soundex(final String mapping, final boolean specialCaseHW) {
196196
this.soundexMapping = mapping.toCharArray();
197197
this.specialCaseHW = specialCaseHW;
198198
}

src/main/java/org/apache/commons/codec/net/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int digit16(final byte b) throws DecoderException {
5858
* @param b the input int
5959
* @return the upper case hex digit of the lower 4 bits of the int.
6060
*/
61-
static char hexDigit(int b) {
61+
static char hexDigit(final int b) {
6262
return Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
6363
}
6464

0 commit comments

Comments
 (0)