Skip to content

Commit 9190143

Browse files
committed
Use final.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1694610 13f79535-47bb-0310-9956-ffa450edef68
1 parent 579105a commit 9190143

9 files changed

Lines changed: 21 additions & 21 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, fi
5656
int tmpLen = length;
5757

5858
while (tmpLen-- > 0) {
59-
char c1 = cs.charAt(index1++);
60-
char c2 = substring.charAt(index2++);
59+
final char c1 = cs.charAt(index1++);
60+
final char c2 = substring.charAt(index2++);
6161

6262
if (c1 == c2) {
6363
continue;

src/main/java/org/apache/commons/codec/language/bm/Languages.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public LanguageSet restrictTo(final LanguageSet other) {
120120
} else {
121121
final SomeLanguages sl = (SomeLanguages) other;
122122
final Set<String> ls = new HashSet<String>(Math.min(languages.size(), sl.languages.size()));
123-
for (String lang : languages) {
123+
for (final String lang : languages) {
124124
if (sl.languages.contains(lang)) {
125125
ls.add(lang);
126126
}
@@ -138,7 +138,7 @@ public LanguageSet merge(final LanguageSet other) {
138138
} else {
139139
final SomeLanguages sl = (SomeLanguages) other;
140140
final Set<String> ls = new HashSet<String>(languages);
141-
for (String lang : sl.languages) {
141+
for (final String lang : sl.languages) {
142142
ls.add(lang);
143143
}
144144
return from(ls);

src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private static final class RulesApplication {
171171
private final Map<String, List<Rule>> finalRules;
172172
private final CharSequence input;
173173

174-
private PhonemeBuilder phonemeBuilder;
174+
private final PhonemeBuilder phonemeBuilder;
175175
private int i;
176176
private final int maxPhonemes;
177177
private boolean found;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ private static boolean isWhitespace(final int b) {
250250
* array of bytes to be encoded
251251
* @return array of bytes containing quoted-printable data
252252
*/
253-
public static final byte[] encodeQuotedPrintable(BitSet printable, final byte[] bytes) {
253+
public static final byte[] encodeQuotedPrintable(final BitSet printable, final byte[] bytes) {
254254
return encodeQuotedPrintable(printable, bytes, false);
255255
}
256256

@@ -270,7 +270,7 @@ public static final byte[] encodeQuotedPrintable(BitSet printable, final byte[]
270270
* @return array of bytes containing quoted-printable data
271271
* @since 1.10
272272
*/
273-
public static final byte[] encodeQuotedPrintable(BitSet printable, final byte[] bytes, boolean strict) {
273+
public static final byte[] encodeQuotedPrintable(BitSet printable, final byte[] bytes, final boolean strict) {
274274
if (bytes == null) {
275275
return null;
276276
}
@@ -284,7 +284,7 @@ public static final byte[] encodeQuotedPrintable(BitSet printable, final byte[]
284284
// encode up to buffer.length - 3, the last three octets will be treated
285285
// separately for simplification of note #3
286286
for (int i = 0; i < bytes.length - 3; i++) {
287-
int b = getUnsignedOctet(i, bytes);
287+
final int b = getUnsignedOctet(i, bytes);
288288
if (pos < SAFE_LENGTH) {
289289
// up to this length it is safe to add any byte, encoded or not
290290
pos += encodeByte(b, !printable.get(b), buffer);

src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void decode(final byte[] pArray, final int i, final int length, final Context co
186186
};
187187

188188
// When
189-
byte actualPaddingByte = codec.pad;
189+
final byte actualPaddingByte = codec.pad;
190190

191191
// Then
192192
assertEquals(0x25, actualPaddingByte);

src/test/java/org/apache/commons/codec/binary/HexTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void testDecodeByteBufferObjectEmpty() throws DecoderException {
232232

233233
@Test
234234
public void testDecodeByteBufferOddCharacters() {
235-
ByteBuffer buffer = ByteBuffer.allocate(1);
235+
final ByteBuffer buffer = ByteBuffer.allocate(1);
236236
buffer.put((byte) 65);
237237
try {
238238
new Hex().decode(buffer);

src/test/java/org/apache/commons/codec/language/DaitchMokotoffSoundexTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ protected DaitchMokotoffSoundex createStringEncoder() {
3636
return new DaitchMokotoffSoundex();
3737
}
3838

39-
private String soundex(String source) {
39+
private String soundex(final String source) {
4040
return getStringEncoder().soundex(source);
4141
}
4242

43-
private String encode(String source) {
43+
private String encode(final String source) {
4444
return getStringEncoder().encode(source);
4545
}
4646

src/test/java/org/apache/commons/codec/language/bm/PhoneticEngineRegressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void testCompatibilityWithOriginalVersion() {
182182
// see CODEC-187
183183
// comparison: http://stevemorse.org/census/soundex.html
184184

185-
Map<String, String> args = new TreeMap<String, String>();
185+
final Map<String, String> args = new TreeMap<String, String>();
186186
args.put("nameType", "GENERIC");
187187
args.put("ruleType", "APPROX");
188188

src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ public void testSoftLineBreakDecode() throws Exception {
258258
final String qpdata = "If you believe that truth=3Dbeauty, then surely=20=\r\nmathematics is the most beautiful branch of philosophy.";
259259
final String expected = "If you believe that truth=beauty, then surely mathematics is the most beautiful branch of philosophy.";
260260

261-
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
261+
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
262262
assertEquals(expected, qpcodec.decode(qpdata));
263263

264-
String encoded = qpcodec.encode(expected);
264+
final String encoded = qpcodec.encode(expected);
265265
assertEquals(expected, qpcodec.decode(encoded));
266266
}
267267

@@ -270,22 +270,22 @@ public void testSoftLineBreakEncode() throws Exception {
270270
final String qpdata = "If you believe that truth=3Dbeauty, then surely mathematics is the most b=\r\neautiful branch of philosophy.";
271271
final String expected = "If you believe that truth=beauty, then surely mathematics is the most beautiful branch of philosophy.";
272272

273-
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
273+
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
274274
assertEquals(qpdata, qpcodec.encode(expected));
275275

276-
String decoded = qpcodec.decode(qpdata);
276+
final String decoded = qpcodec.decode(qpdata);
277277
assertEquals(qpdata, qpcodec.encode(decoded));
278278
}
279279

280280
@Test
281281
public void testSkipNotEncodedCRLF() throws Exception {
282-
String qpdata = "CRLF in an\n encoded text should be=20=\r\n\rskipped in the\r decoding.";
283-
String expected = "CRLF in an encoded text should be skipped in the decoding.";
282+
final String qpdata = "CRLF in an\n encoded text should be=20=\r\n\rskipped in the\r decoding.";
283+
final String expected = "CRLF in an encoded text should be skipped in the decoding.";
284284

285-
QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
285+
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
286286
assertEquals(expected, qpcodec.decode(qpdata));
287287

288-
String encoded = qpcodec.encode(expected);
288+
final String encoded = qpcodec.encode(expected);
289289
assertEquals(expected, qpcodec.decode(encoded));
290290
}
291291

0 commit comments

Comments
 (0)