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 bec18930 [IO-811] Files.walk() direct and indirect callers fail to 
close the returned Stream<Path>
bec18930 is described below

commit bec18930208014e25774e38d88660ab379c07634
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Sep 30 08:48:39 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 607d6aad..314983f2 100644
--- a/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
+++ b/src/test/java/org/apache/commons/io/file/FilesUncheckTest.java
@@ -210,12 +210,16 @@ public class FilesUncheckTest {
 
     @Test
     public void testLinesPath() {
-        assertEquals(0, FilesUncheck.lines(FILE_PATH_EMPTY).count());
+        try (Stream<String> stream = FilesUncheck.lines(FILE_PATH_EMPTY)) {
+            assertEquals(0, stream.count());
+        }
     }
 
     @Test
     public void testLinesPathCharset() {
-        assertEquals(0, FilesUncheck.lines(FILE_PATH_EMPTY, 
StandardCharsets.UTF_8).count());
+        try (Stream<String> stream = FilesUncheck.lines(FILE_PATH_EMPTY, 
StandardCharsets.UTF_8)) {
+            assertEquals(0, stream.count());
+        }
     }
 
     @Test

Reply via email to