You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/09/11 00:31:33 UTC
[commons-vfs] 03/04: Use final.
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-vfs.git
commit b2397b1a2b365b515a5130ba7e33e546f5b84733
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 10 20:20:57 2020 -0400
Use final.
---
.../vfs2/provider/http5s/test/Http5sGetContentInfoTest.java | 2 +-
.../provider/local/LocalFileRandomAccessContentTestCase.java | 4 ++--
.../ram/test/RamFileRandomAccessContentTestCase.java | 2 +-
.../vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java | 12 ++++++------
.../vfs2/provider/tar/test/CreateFileSystemTestCase.java | 8 ++++----
.../vfs2/provider/tar/test/TarFileObjectTestCase.java | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/test/Http5sGetContentInfoTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/test/Http5sGetContentInfoTest.java
index 6c354a2..c72889f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/test/Http5sGetContentInfoTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5s/test/Http5sGetContentInfoTest.java
@@ -74,7 +74,7 @@ public class Http5sGetContentInfoTest extends TestCase {
final FileObject fo = fsManager.resolveFile(uri, getOptionsWithSSL());
final FileContent content = fo.getContent();
try(InputStream is = content.getInputStream()){
- String text = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
+ final String text = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
assertNotNull(text);
}
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTestCase.java
index 93205fa..4190bf2 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/LocalFileRandomAccessContentTestCase.java
@@ -37,12 +37,12 @@ public class LocalFileRandomAccessContentTestCase {
@Test
public void testInputStreamRead0xff() throws IOException {
// open test file,this file has only one byte data 0xff
- File file = new File("src/test/resources/test-data/0xff_file.txt");
+ final File file = new File("src/test/resources/test-data/0xff_file.txt");
// read test data,first data should be 0xFF instead of -1. Will read -1 finally (EOF)
try (InputStream in = new LocalFileRandomAccessContent(file, RandomAccessMode.READ).getInputStream()) {
// read first data
- int read = in.read();
+ final int read = in.read();
Assert.assertNotEquals(EOF, read);
Assert.assertEquals(0xFF, read);
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamFileRandomAccessContentTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamFileRandomAccessContentTestCase.java
index bf43a89..13953c9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamFileRandomAccessContentTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamFileRandomAccessContentTestCase.java
@@ -50,7 +50,7 @@ public class RamFileRandomAccessContentTestCase {
// read test data,first data should be 0xFF instead of -1. Will read -1 finally (EOF)
try (InputStream in = new RamFileRandomAccessContent((RamFileObject) file, RandomAccessMode.READ).getInputStream()) {
// read first data
- int read = in.read();
+ final int read = in.read();
Assert.assertNotEquals(EOF, read);
Assert.assertEquals(0xFF, read);
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java
index c2caf57..e8db381 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java
@@ -64,11 +64,11 @@ public class SftpMultiThreadWriteTests extends AbstractProviderTestCase {
public void testParallelCopyFromLocalFileSystem() throws Exception {
final File localFile = new File("src/test/resources/test-data/test.zip");
- FileObject localFileObject = VFS.getManager().toFileObject(localFile);
+ final FileObject localFileObject = VFS.getManager().toFileObject(localFile);
final FileObject scratchFolder = createScratchFolder();
- List<Callable<Boolean>> tasks = new ArrayList<>();
+ final List<Callable<Boolean>> tasks = new ArrayList<>();
for (int i = 0; i < 100; i++) {
final String fileName = "file" + i + "copy.txt";
tasks.add(() -> {
@@ -77,20 +77,20 @@ public class SftpMultiThreadWriteTests extends AbstractProviderTestCase {
assertFalse(fileCopy.exists());
fileCopy.copyFrom(localFileObject, Selectors.SELECT_SELF);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
return false;
}
return true;
});
}
- ExecutorService service = Executors.newFixedThreadPool(10);
+ final ExecutorService service = Executors.newFixedThreadPool(10);
try {
- List<Future<Boolean>> futures = service.invokeAll(tasks);
+ final List<Future<Boolean>> futures = service.invokeAll(tasks);
assertTrue(futures.stream().allMatch(fut -> {
try {
return fut.get(5, TimeUnit.SECONDS);
- } catch (Exception e) {
+ } catch (final Exception e) {
return false;
}
}));
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/CreateFileSystemTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/CreateFileSystemTestCase.java
index cc867bd..71a7728 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/CreateFileSystemTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/CreateFileSystemTestCase.java
@@ -36,7 +36,7 @@ public class CreateFileSystemTestCase {
private FileObject createFileSystem(final String testFilePath) throws IOException {
final File testFile = new File(testFilePath);
- FileSystemManager manager = VFS.getManager();
+ final FileSystemManager manager = VFS.getManager();
// create fileSystem and return fileObject
try (FileObject localFileObject = manager.resolveFile(testFile.getAbsolutePath())) {
@@ -47,7 +47,7 @@ public class CreateFileSystemTestCase {
@Test
public void testTarFile() throws IOException {
- String testFilePath = "src/test/resources/test-data/test.tar";
+ final String testFilePath = "src/test/resources/test-data/test.tar";
try (FileObject fileObject = createFileSystem(testFilePath)) {
Assert.assertTrue(fileObject instanceof TarFileObject);
}
@@ -56,7 +56,7 @@ public class CreateFileSystemTestCase {
@Test
public void testTgzFile() throws IOException {
- String testFilePath = "src/test/resources/test-data/test.tgz";
+ final String testFilePath = "src/test/resources/test-data/test.tgz";
try (FileObject fileObject = createFileSystem(testFilePath)) {
Assert.assertTrue(fileObject instanceof TarFileObject);
}
@@ -65,7 +65,7 @@ public class CreateFileSystemTestCase {
@Test
public void testTbz2File() throws IOException {
- String testFilePath = "src/test/resources/test-data/test.tbz2";
+ final String testFilePath = "src/test/resources/test-data/test.tbz2";
try (FileObject fileObject = createFileSystem(testFilePath)) {
Assert.assertTrue(fileObject instanceof TarFileObject);
}
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/TarFileObjectTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/TarFileObjectTestCase.java
index ad1840e..ab9c02f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/TarFileObjectTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/test/TarFileObjectTestCase.java
@@ -55,7 +55,7 @@ public class TarFileObjectTestCase {
testReadSpecialNameFileInFile("src/test/resources/test-data/special_fileName.tbz2", "tbz2");
}
- private void testReadSpecialNameFileInFile(String testFilePath, String scheme) throws FileSystemException {
+ private void testReadSpecialNameFileInFile(final String testFilePath, final String scheme) throws FileSystemException {
final File testFile = new File(testFilePath);
final String[] fileNames = {"file.txt", "file^.txt", "file~.txt", "file?.txt", "file@.txt", "file$.txt",