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

ResourceBundle has a file descriptor leak

XMLWordPrintable

    • 1.2beta4
    • generic
    • generic
    • Not verified



      Name: dgC58589 Date: 11/14/97


      java.util.ResourceBundle has a file descriptor leak.
      It never closes the file that it opened to read
      the resources. If the file that is returned is
      a normal file input stream, then finalization will
      eventually close the file. But if the file is a
      random access file, which has no finalization method
      (I already filed a bug about that), then the file
      is never closed.

      Here's the code fragment from ResourceBundle.findBundle()
      that doesn't close the file:

                  debug("Searching for " + searchName );
                  stream = loader.getResourceAsStream(searchName);
                  if( stream != null ) {
      // make sure it is buffered
      stream = new java.io.BufferedInputStream(stream);
                      try {
                          lookup = (Object)new PropertyResourceBundle( stream );
                          break searchLoop;
                      } catch (Exception e) {}
                  }


      (Review ID: 20161)
      ======================================================================

            rgillamsunw Richard Gillam (Inactive)
            dgrahamcsunw David Graham-cumming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: