mirror of https://github.com/apache/maven.git
MNG-7293:fix resource leak due to Files.walk
This commit is contained in:
parent
ccb76b0db6
commit
fbb9d95d50
|
@ -34,6 +34,7 @@ import java.util.Formatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
@ -140,11 +141,13 @@ public class Installer
|
||||||
|
|
||||||
private List<Path> listDirs( Path distDir ) throws IOException
|
private List<Path> listDirs( Path distDir ) throws IOException
|
||||||
{
|
{
|
||||||
return Files.walk( distDir, 1 )
|
try ( Stream<Path> stream = Files.walk( distDir, 1 ) )
|
||||||
.filter( p -> !distDir.equals( p ) )
|
{
|
||||||
|
return stream.filter( p -> !distDir.equals( p ) )
|
||||||
.filter( Files::isDirectory )
|
.filter( Files::isDirectory )
|
||||||
.collect( Collectors.toList() );
|
.collect( Collectors.toList() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setExecutablePermissions( Path mavenHome )
|
private void setExecutablePermissions( Path mavenHome )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue