Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6714834

JarFile.getManifest() leaves an open InputStream as an undocumented side effect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 16
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b16
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
      Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux hostname.example.com 2.6.24-18-generic #1 SMP Wed May 28 20:27:26 UTC 2008 i686 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When calling this code:

      JarFile myJar = new JarFile(someFile);
      Manifest manifest = myJar.getManifest();

      internally, a new inputstream is opened for reading the manifest entry. This inputstream doesn't get closed when getManifest() is done and is left on that JarFile. This side effect isn't documented in the javadocs and can lead to serious and hard to track bugs (e.g. when replacing the manifest and generating a new JarFile, the old one can be unexpectedly taken in some circumstances unless one calls myJar.close() after myJar.getManifest()).



      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lancea Lance Andersen
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: