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
The following commit(s) were added to refs/heads/master by this push:
new 3d1b6c4 Use try-with-resources.
3d1b6c4 is described below
commit 3d1b6c40a029d6700380114aaa8bb964033245a7
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Sep 25 22:31:01 2020 -0400
Use try-with-resources.
---
.../commons/vfs2/impl/test/DefaultFileMonitorTest.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
index dafc699..7c9ee98 100644
---
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
+++
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTest.java
@@ -208,9 +208,12 @@ public class DefaultFileMonitorTest extends
AbstractVfsTestCase {
monitor.addFile(fileObject);
monitor.start();
- writeToFile(testFile);
- Thread.sleep(500);
- monitor.stop();
+ try {
+ writeToFile(testFile);
+ Thread.sleep(500);
+ } finally {
+ monitor.stop();
+ }
monitor.start();
try {
@@ -260,8 +263,11 @@ public class DefaultFileMonitorTest extends
AbstractVfsTestCase {
final CountingListener stoppedListener = new CountingListener();
final DefaultFileMonitor stoppedMonitor = new
DefaultFileMonitor(stoppedListener);
stoppedMonitor.start();
- stoppedMonitor.addFile(fileObject);
- stoppedMonitor.stop();
+ try {
+ stoppedMonitor.addFile(fileObject);
+ } finally {
+ stoppedMonitor.stop();
+ }
// Variant 1: it becomes documented behavior to manually remove
all files after stop() such that all
// listeners