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

Optimize ZipFile.getEntry() for loading of classes and resources

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs



      Name: rmT116609 Date: 06/04/2003


      FULL PRODUCT VERSION :
      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      During class- and resource-loading methods java.util.jar.JarFile.getEntry() and java.util.zip.ZipFile.getEntry() will be called for every JAR in the CLASSPATH until the class or resource is found.

      If there is no entry in the JAR with the name passed to the method, java.util.zip.ZipFile.getEntry() will append a '/' to the name and try again.

      This happens quite often, especially with many classes and many JARs, and the String-concatenation causes lots of char[], String and StringBuffer objects to be allocated and garbage-collected.

      Since trying a directory name does not make sense when loading classes and resources with fully specified names, I suggest implementing methods JarFile.getFileEntry() and ZipFile.getFileEntry(), which only look for files and should be used for class and resource-loading.

      (Review ID: 186926)
      ======================================================================

            eirbjo Eirik Bjørsnøs
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: