Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MJAVADOC-644] Properly close DirectoryStream #41

Merged
merged 1 commit into from Mar 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,6 +22,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
Expand Down Expand Up @@ -139,10 +140,10 @@ public static void writeStaleData( Commandline cmd, Path path )

private static Collection<Path> walk( Path dir )
{
try
Collection<Path> paths = new ArrayList<>();
try ( DirectoryStream<Path> directoryStream = Files.newDirectoryStream( dir ) )
{
Collection<Path> paths = new ArrayList<>();
for ( Path p : Files.newDirectoryStream( dir ) )
for ( Path p : directoryStream )
{
paths.add( p );
}
Expand Down