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

Jar index should avoid putting META-INF in the INDEX.LIST

    XMLWordPrintable

Details

    • b130
    • generic
    • generic
    • Verified

    Backports

      Description

        "META-INF" will be included in the jar index (INDEX.LIST) if there is any file directly in META-INF/ directory, other than the manifest or the index itself. This can cause unnecessary downloading of indexed jars in cases where the classloader is being used to try and find a service that may be defined in META-INF/.

        A good example of this is custom fonts in javafx. Fonts are define in META-INF/fonts.mf and the classloader is used to search for these fonts. Now suppose you have a fully indexed javafx application and indexed javafx runtime. If your application inadvertantly tries to use an undefined font it will force all of the jars (both eager and lazy) to be downloaded as it searches for the fonts.mf in each jar.

        java.util.ServiceLoader does suffer from this problem, but is slightly different as it uses the META-INF/serivces directory. If a jar defines any service then it may be downloaded only to find out that the service it defines is not actually the one that is required. It would be better to index the actual services and not just META-INF/services.

        Attachments

          Issue Links

            Activity

              People

                chegar Chris Hegarty
                chegar Chris Hegarty
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: