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

Jar is not usable for testing integrity of Jar files.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.4.2_05, 6
    • tools
    • jar
    • generic
    • generic, solaris_8

      We have a known corrupt jar file called saxorig.jar, but:

      jar tvf saxorig.jar

      ...works fine.

      A test program which opens the problem file as either JarFile or a ZipFile will fail:

      (5.9)$ java ListJar saxorig.jar
      Error accessing: saxorig.jar: java.util.zip.ZipException: error in opening zip file
      java.util.zip.ZipException: error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:112)
              at java.util.jar.JarFile.<init>(JarFile.java:127)
              at java.util.jar.JarFile.<init>(JarFile.java:65)
              at ListJar.main(ListJar.java:11)
              
      "jar tvf" would seem like a reasonable test for corrupt Jar/Zip files, but (some) corrupt files can pass that test, yet still be unusable. "jar xvf" can even extract all the files in the case of this specific instance of a captured corrupt jar file, while the classloader and the attached test program fail to open it.
      (Yes, extracting and repackaging the jar fixes the problem.)
      ###@###.### 11/3/04 15:44 GMT

            Unassigned Unassigned
            kevinw Kevin Walls
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: