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

Creating JAR index using "jar i" fails if Class-Path contains successive blanks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • v3.1
    • tools
    • None
    • jar
    • x86
    • windows_xp

      If a JAR file's Class-Path contains successive blanks, then

      jar i x.jar

      fails. I guess that the jar utility treats the successive blanks as delimiters around an empty string and then tries to resolve the empty string as a path relative to the JAR's directory. This yields the directory itself which, of course, cannot be opened as a JAR.

      The jar utility should (1) tolerate such successive blanks by ignoring them and (2) report the context (what JAR is being processed, what Class-Path entry is being processed) at the time of any such an error.

      This also happens when you try to index y.jar which refers to x.jar in its Class-Path.


      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:114)
      at java.util.jar.JarFile.<init>(JarFile.java:133)
      at java.util.jar.JarFile.<init>(JarFile.java:70)
      at sun.tools.jar.Main.getJarPath(Main.java:935)
      at sun.tools.jar.Main.getJarPath(Main.java:951)
      at sun.tools.jar.Main.genIndex(Main.java:967)
      at sun.tools.jar.Main.run(Main.java:217)
      at sun.tools.jar.Main.main(Main.java:1044)

            sherman Xueming Shen
            tjquinn Tim Quinn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: