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

Jar indexing fails to include META-INF in index so service provider config fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u6
    • tools
    • jar
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_06"
      Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
      Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP
      Windows Vista
      Linux
      probably all others

      A DESCRIPTION OF THE PROBLEM :
      When using
      jar i main.jar lib1.jar lib2.jar
      it is not possible to use service provider configuration in META-INF, because the META-INF is not listed in the INDEX.LIST in main.jar.
      When providing e.g mail.jar as one of the libs, the mailcap file can not be found.

      This makes jar indexing difficult to use, because all META-INF data must be manually transferred to the main jar.

      If the reader never used jar indexing before, please look at:
      http://www.ibm.com/developerworks/library/j-jar/index.html

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. take one jar file as main.jar and list lib1.jar in the class-path attribute of mainfest
      2. take sun's mail.jar as lib1.jar
      3. invoke
         jar i main.jar lib1.jar
      4. Try to load the resource META-INF/mailcap via the classloader

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      we expect, that META-INF/mailcap is found, because lib1.jar is listed in class-path attribute of mainfest
      ACTUAL -
      resource is not found

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      As mentioned above, the jars can be organized in such a way, that all service provider information is found only in main.jar.
      An ant snippet would look like this:

      <jar
              index="true" jarfile="main.jar" basedir="classes">
      <manifest>
      <attribute name="Class-Path" value="lib1.jar lib2.jar"/>
      </manifest>
      <indexjars path="${web.home}/applet/lib1.jar"/>
      <indexjars path="${web.home}/applet/lib2.jar"/>
        <zipfileset src="lib1.jar" excludes="*.LIST *.RSA. *.SF" includes="META-INF/**"/>
           <zipfileset src="lib2.jar" excludes="*.LIST *.RSA. *.SF" includes="META-INF/**"/>
      </jar>

      Can this be fixed, or is it just a lack of documention and understanding?

            bristor Dave Bristor (Inactive)
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: