You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2021/09/30 10:09:00 UTC

[jira] [Updated] (MNG-7275) Resource leak due to Files.list()

     [ https://issues.apache.org/jira/browse/MNG-7275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Osipov updated MNG-7275:
--------------------------------
    Description: 
Leak happends at

[https://github.com/apache/maven/blob/c3cf29438e3d65d6ee5c5726f8611af99d9a649a/maven-wrapper/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java#L52]

 

Files.list  will opendir and we should close it.

 

{{try(Stream<Path> list = Files.list())}} is the most common practice 

  was:
Leak happends at

[https://github.com/apache/maven/blob/c3cf29438e3d65d6ee5c5726f8611af99d9a649a/maven-wrapper/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java#L52]

 

Files.list  will opendir and we should close it.

 

try(Stream<Path> list = Files.list()) is the most common practice 

 


> Resource leak due to Files.list()
> ---------------------------------
>
>                 Key: MNG-7275
>                 URL: https://issues.apache.org/jira/browse/MNG-7275
>             Project: Maven
>          Issue Type: Bug
>            Reporter: lujie
>            Priority: Major
>
> Leak happends at
> [https://github.com/apache/maven/blob/c3cf29438e3d65d6ee5c5726f8611af99d9a649a/maven-wrapper/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java#L52]
>  
> Files.list  will opendir and we should close it.
>  
> {{try(Stream<Path> list = Files.list())}} is the most common practice 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)