You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (Jira)" <ji...@apache.org> on 2020/02/05 22:52:00 UTC

[jira] [Updated] (MINDEXER-123) Fix an InputStream leak in indexer-reader Utils

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

Sylwester Lachiewicz updated MINDEXER-123:
------------------------------------------
    Fix Version/s: 6.0.1

> Fix an InputStream leak in indexer-reader Utils
> -----------------------------------------------
>
>                 Key: MINDEXER-123
>                 URL: https://issues.apache.org/jira/browse/MINDEXER-123
>             Project: Maven Indexer
>          Issue Type: Bug
>            Reporter: Stephen Buergler
>            Priority: Trivial
>             Fix For: 6.0.1
>
>
> There is a leak of an InputReader in Utils.
> {code:java}
>     /**
>      * Creates and loads {@link Properties} from provided {@link Resource} if exists, and closes the resource. If not
>      * exists, returns {@code null}.
>      */
>     public static Properties loadProperties( final Resource resource )
>         throws IOException
>     {
>         final InputStream inputStream = resource.read();
>         if ( inputStream == null )
>         {
>             return null;
>         }
>         return loadProperties( resource.read() );
>     }
> {code}
> Depending on how the Resource is implemented this probably leaks the InputStream returned by the first .read() call. I'm under the understanding that .read() should return a new InputStream every time it is called but I don't have any evidence that that is true other than that's how the Resource in the unit test is implemented.



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