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

JarInputStream returns null Manifest for Indexed JarFile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.4.0
    • tools
    • jar
    • generic, sparc
    • generic, solaris_8

      Method getManifest in java.util.jar.JarInputStream returns null Manifest for a Indexed JarFile . While it is returning exact values for an unindexed Jarfile .

      This occurs in Win32 platforms (95,98,NT) and Solaris 2.7

      Steps to reproduce the bug
      ---------------------------
      1) set the path to latest merlin build
      2) copy the attached files
      3) javac GetManifestTests.java
      4) java GetManifestTests


      Name: jl125535 Date: 11/11/2002


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Construct one jar file that contains manifest file so that
      manifest file is not first entry in jar file.(Use for
      example zip tool)



      A DESCRIPTION OF THE PROBLEM :
      Even the jar file contains manifest file, the getManifest
      method returns null

      Jar tool provided by Sun will always generate such jar file
      that manifest is first entry.
      But specification of jar file does not say that manifest
      must be the first entry.
      http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. create jar file that contains manifest file, so that
      mnaifest is not first entry in jar file(use for example zip
      tool)
      2. run example code(Test <jarfile name>)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Test program prints out:
      Manifest is:null

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.jar.JarInputStream;
      import java.util.jar.Manifest;
      import java.io.FileInputStream;

      public class Test
      {
          public static void main(String arg[])
          {
              try
              {
                  FileInputStream fin = new FileInputStream(arg[0]);

                  JarInputStream jin = new JarInputStream(fin);

                  Manifest m = jin.getManifest();
                  System.out.println("Manifest is:" + m);
              }
              catch(Exception e )
              {
              }
          }
      }
      ---------- END SOURCE ----------
      (Review ID: 166718)
      ======================================================================

            sherman Xueming Shen
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: