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

javac crashes with ArrayIndexOutOfBoundsException on ZIP merged jar files.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 1.4.2_07
    • 1.4.2, 1.4.2_07
    • tools
    • x86, sparc
    • solaris_8, windows_xp

      A dynamically create Jar -File contains the same class twice (fully qualified class name is identical). This is allowed by the zip format and the error causing zip file is the result of a merge process of different jar files.

      The runtime does not have a problem, but the compiler fails -> this seems to be a bug.

      Test Case:
      Class A and Class B uses Class A

      jar File x.jar containing twice Class A (in different size)

      javac -cp x.jar B.java

      [build] An exception has occurred in the compiler (1.4.2_05). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      [build] java.lang.ArrayIndexOutOfBoundsException: 1932486510
      [build] at com.sun.tools.javac.v8.code.ClassReader.nextInt(ClassReader.java:335)
      [build] at com.sun.tools.javac.v8.code.ClassReader.skipMember(ClassReader.java:820)
      [build] at com.sun.tools.javac.v8.code.ClassReader.readClass(ClassReader.java:861)
      [build] at com.sun.tools.javac.v8.code.ClassReader.readClassFile(ClassReader.java:936)
      [build] at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1091)
      [build] at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1049)
      [build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
      [build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
      [build] at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1130)
      [build] at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:471)
      [build] at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:644)
      [build] at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1127)
      [build] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1076)
      [build] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
      [build] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)
      [build] at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:228)
      [build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:763)
      [build] at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:407)
      [build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
      [build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:727)
      [build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:746)
      [build] at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
      [build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
      [build] at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:848)
      [build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
      [build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
      [build] at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:601)
      [build] at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:582)
      [build] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:331)
      [build] at com.sun.tools.javac.v8.Main.compile(Main.java:569)
      [build] at com.sun.tools.javac.Main.compile(Main.java:36)

      This occurs because the developer has merged a.jar with b.jar both are containing the class a.b.AB
      After the merge the ab.jar will contain twice the class a.b.AB.

      The merge is done with Ant's zip functions, *not* with jar.
      ###@###.### 2005-2-24 14:52:45 GMT

            ahe Peter Ahe
            mbowyer Mark Bowyer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: