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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 6
    • core-libs
    • b16
    • x86
    • linux

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: