Uploaded image for project: 'Maven Indexer'
  1. Maven Indexer
  2. MINDEXER-123

Fix an InputStream leak in indexer-reader Utils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 6.1.0, 6.1.1
    • None

    Description

      There is a leak of an InputReader in Utils.

          /**
           * 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() );
          }
      

      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.

      Attachments

        Activity

          People

            eolivelli Enrico Olivelli
            sixcorners Stephen Buergler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: