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-io.git
The following commit(s) were added to refs/heads/master by this push:
new 6931ffe4 [IO-811] Files.walk() direct and indirect callers fail to
close the returned Stream<Path>
6931ffe4 is described below
commit 6931ffe48094e423a1d137eb8d6ac0c8d107c5e3
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Sep 30 08:50:50 2023 -0400
[IO-811] Files.walk() direct and indirect callers fail to close the
returned Stream<Path>
- Release resource in test
---
src/test/java/org/apache/commons/io/file/FilesUncheckTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
b/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
index 314983f2..80f4d37b 100644
--- a/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
+++ b/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
@@ -435,12 +435,16 @@ public class FilesUncheckTest {
@Test
public void testWalkPathFileVisitOptionArray() {
- assertTrue(0 < FilesUncheck.walk(TARGET_PATH,
FileVisitOption.FOLLOW_LINKS).count());
+ try (Stream<Path> stream = FilesUncheck.walk(TARGET_PATH,
FileVisitOption.FOLLOW_LINKS)) {
+ assertTrue(0 < stream.count());
+ }
}
@Test
public void testWalkPathIntFileVisitOptionArray() {
- assertEquals(1, FilesUncheck.walk(TARGET_PATH, 0,
FileVisitOption.FOLLOW_LINKS).count());
+ try (Stream<Path> stream = FilesUncheck.walk(TARGET_PATH, 0,
FileVisitOption.FOLLOW_LINKS)) {
+ assertEquals(1, stream.count());
+ }
}
@Test