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 2022/11/25 18:49:29 UTC
[commons-vfs] branch master updated (eb49b00d -> 432aeb6f)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
from eb49b00d Update JKS for some tests to pass on 1.8.0_352
new de81f7bd Remove unused exception
new 432aeb6f Use try-with-resources
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../vfs2/operations/BasicOperationsTest.java | 46 +++++++++++-----------
1 file changed, 24 insertions(+), 22 deletions(-)
[commons-vfs] 01/02: Remove unused exception
Posted by gg...@apache.org.
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 de81f7bdfdde4cc411ac4ab586f204a6cde0ae6a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 25 13:42:34 2022 -0500
Remove unused exception
---
.../java/org/apache/commons/vfs2/operations/BasicOperationsTest.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
index ee248dca..04a6f9ec 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
@@ -113,11 +113,9 @@ public class BasicOperationsTest {
/**
* JUnit Fixture: Tear Down the FSM.
- *
- * @throws FileSystemException for runtime problems
*/
@AfterEach
- public void tearDown() throws FileSystemException {
+ public void tearDown() {
if (manager != null) {
manager.close();
manager = null;
[commons-vfs] 02/02: Use try-with-resources
Posted by gg...@apache.org.
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 432aeb6f84c56d229667f3453f40337756f1ddb5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 25 13:49:24 2022 -0500
Use try-with-resources
---
.../vfs2/operations/BasicOperationsTest.java | 42 ++++++++++++----------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
index 04a6f9ec..96034289 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java
@@ -69,6 +69,7 @@ public class BasicOperationsTest {
/** This FileOperationsProvider is no VfsComponent. */
static class MyFileOperationProviderNoncomp extends MyFileOperationProviderBase {
+ // empty
}
/**
@@ -106,6 +107,7 @@ public class BasicOperationsTest {
@BeforeEach
public void setUp() throws FileSystemException {
manager = new DefaultFileSystemManager();
+ @SuppressWarnings("resource") // manager is closed on @AfterEach
final FileProvider fp = new DefaultLocalFileProvider();
manager.addProvider("file", fp);
manager.init();
@@ -129,13 +131,13 @@ public class BasicOperationsTest {
*/
@Test
public void testLifecycleComp() throws FileSystemException {
- final MyFileOperationProviderBase myop = new MyFileOperationProviderComp();
- assertEquals(0, myop.ops);
- manager.addOperationProvider("file", myop);
- assertEquals(7, myop.ops);
- manager.close();
- assertEquals(15, myop.ops, "close() not called"); // VFS-577
-
+ try (final MyFileOperationProviderComp myop = new MyFileOperationProviderComp()) {
+ assertEquals(0, myop.ops);
+ manager.addOperationProvider("file", myop);
+ assertEquals(7, myop.ops);
+ manager.close();
+ assertEquals(15, myop.ops, "close() not called"); // VFS-577
+ }
// fixture will close again
}
@@ -163,14 +165,15 @@ public class BasicOperationsTest {
public void testNotFoundAny() throws FileSystemException {
final MyFileOperationProviderBase myop = new MyFileOperationProviderNoncomp();
manager.addOperationProvider("file", myop);
- final FileObject fo = manager.toFileObject(new File("."));
+ try (final FileObject fo = manager.toFileObject(new File("."))) {
- final FileOperations ops = fo.getFileOperations();
- assertNotNull(ops);
+ final FileOperations ops = fo.getFileOperations();
+ assertNotNull(ops);
- final Class<? extends FileOperation>[] oparray = ops.getOperations();
- assertSame(0, oparray.length, "no ops should be found");
- assertSame(16, myop.ops); // collect
+ final Class<? extends FileOperation>[] oparray = ops.getOperations();
+ assertSame(0, oparray.length, "no ops should be found");
+ assertSame(16, myop.ops); // collect
+ }
}
/**
@@ -182,14 +185,15 @@ public class BasicOperationsTest {
public void testNotFoundOperation() throws FileSystemException {
final MyFileOperationProviderBase myop = new MyFileOperationProviderNoncomp();
manager.addOperationProvider("file", myop);
- final FileObject fo = manager.toFileObject(new File("."));
+ try (final FileObject fo = manager.toFileObject(new File("."))) {
- final FileOperations ops = fo.getFileOperations();
- assertNotNull(ops);
+ final FileOperations ops = fo.getFileOperations();
+ assertNotNull(ops);
- FileSystemException thrown = assertThrows(FileSystemException.class, () -> ops.getOperation(VcsLog.class));
- assertEquals("vfs.operation/operation-not-supported.error", thrown.getCode());
- assertSame(32, myop.ops); // getOperation was called
+ FileSystemException thrown = assertThrows(FileSystemException.class, () -> ops.getOperation(VcsLog.class));
+ assertEquals("vfs.operation/operation-not-supported.error", thrown.getCode());
+ assertSame(32, myop.ops); // getOperation was called
+ }
}
}