Skip to content

Commit 3af8052

Browse files
committed
Use final
1 parent ce34880 commit 3af8052

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/org/apache/commons/io/FileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int getLength(final CharSequence value, final Charset charset) {
127127
.onUnmappableCharacter(CodingErrorAction.REPORT);
128128
try {
129129
return enc.encode(CharBuffer.wrap(value)).remaining();
130-
} catch (CharacterCodingException e) {
130+
} catch (final CharacterCodingException e) {
131131
// Unencodable, does not fit any byte limit.
132132
return Integer.MAX_VALUE;
133133
}

src/test/java/org/apache/commons/io/FileSystemTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class FileSystemTest {
117117
/** File name of 511 bytes and 255 UTF-16 code units. */
118118
private static final String FILE_NAME_255CHARS_UTF8_4B = repeat(CHAR_UTF8_4B, 127) + CHAR_UTF8_3B;
119119

120-
private static void createAndDelete(Path tempDir, String fileName) throws IOException {
120+
private static void createAndDelete(final Path tempDir, final String fileName) throws IOException {
121121
final Path filePath = tempDir.resolve(fileName);
122122
Files.createFile(filePath);
123123
try (Stream<Path> files = Files.list(tempDir)) {
@@ -303,7 +303,7 @@ void testIsLegalName_Encoding() {
303303

304304
@ParameterizedTest(name = "{index}: {0} with charset {2}")
305305
@MethodSource
306-
void testIsLegalName_Length(FileSystem fs, String nameAtLimit, Charset charset) {
306+
void testIsLegalName_Length(final FileSystem fs, final String nameAtLimit, final Charset charset) {
307307
assertTrue(fs.isLegalFileName(nameAtLimit, charset), fs.name() + " length at limit");
308308
final String nameOverLimit = nameAtLimit + "a";
309309
assertFalse(fs.isLegalFileName(nameOverLimit, charset), fs.name() + " length over limit");
@@ -346,7 +346,7 @@ void testIsReservedFileNameOnWindows() {
346346
}
347347

348348
@Test
349-
void testMaxNameLength_MatchesRealSystem(@TempDir Path tempDir) {
349+
void testMaxNameLength_MatchesRealSystem(@TempDir final Path tempDir) {
350350
final FileSystem fs = FileSystem.getCurrent();
351351
final String[] validNames;
352352
switch (fs) {
@@ -419,15 +419,15 @@ void testMaxNameLength_MatchesRealSystem(@TempDir Path tempDir) {
419419

420420
@ParameterizedTest(name = "{index}: {0} truncates {1} to {2}")
421421
@MethodSource
422-
void testNameLengthStrategyTruncate_Succeeds(NameLengthStrategy strategy, int limit, String input, String expected) {
422+
void testNameLengthStrategyTruncate_Succeeds(final NameLengthStrategy strategy, final int limit, final String input, final String expected) {
423423
final CharSequence out = strategy.truncate(input, limit, UTF_8);
424424
assertEquals(expected, out.toString(), strategy.name() + " truncates to limit");
425425
}
426426

427427
@ParameterizedTest(name = "{index}: {0} truncates {2} with limit {1} throws")
428428
@MethodSource
429429
void testNameLengthStrategyTruncate_Throws(
430-
NameLengthStrategy strategy, int limit, String input, Charset charset, String message) {
430+
final NameLengthStrategy strategy, final int limit, final String input, final Charset charset, final String message) {
431431
final IllegalArgumentException ex =
432432
assertThrows(IllegalArgumentException.class, () -> strategy.truncate(input, limit, charset));
433433
final String exMessage = ex.getMessage();

0 commit comments

Comments
 (0)