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

pack200: should default to 150.7 pack format for classfiles without any classes.

    Details

    • Subcomponent:
    • Resolved In Build:
      b100
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp, windows_7
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_10-beta"
      Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b24)
      Java HotSpot(TM) Client VM (build 11.0-b12, mixed mode, sharing)

      Reproducible with other Java 6 verisons, e.g. Update 6 as well.

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Java 5 cannot unpack .jar.pack.gz files created with Java 6. In my case I tested with Java 6 Update 10 [build 24] and Java 5 Update 15 with the command line utilities, but others have reproduced this with Java 6 Update 6 and Java 5 Update 11. Moreover the issue has been seen with Java 5 Web Start clients of a Java 6 server.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use Java 6's pack200 utility to create a .jar.pack.gz file from a jar. Use Java 5's unpack200 to try to unpack it.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Pack200 files created in Java 6 should be readable in Java 5 -- at the very least with a "-target 1.5" option or some such.
      ACTUAL -
      It is apparently impossible to create pack200 files with Java 6 that can be used with Java 5!

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Corrupted pack file: magic/ver = CAFED00D/160.1 should be CAFED00D/150.7

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Create all pack200 files with Java 5 -- which means installing an additional JDK on one's server, having one's server app know this location, etc.

      Overall this is a real issue specifically for Java 6 Update 10 as it really hurts the ease of Java client deployment!

        Issue Links

          Activity

          Hide
          ksrini Kumar Srinivasan added a comment -
          BT2:WORK AROUND

          add a null class as shown below compiled with -target 5.

          The test script:
          % cat doit
          #!/bin/sh -x

          echo "create a failure case"
          echo "Junk" > junk
          jar cvf foo.jar junk
          /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar
          /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar


          echo "demonstrate how to fix this"
          printf "public class Foo{}" > Foo.java
          /usr/jdk/instances/jdk1.6.0/bin/javac -target 5 Foo.java
          jar uvf foo.jar Foo.class

          rm -f bar.jar
          /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar
          /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar

          if [ -f bar.jar ]; then
            printf "It worked\n"
          fi

          % ./doit
          + echo create a failure case
          create a failure case
          + echo Junk
          + jar cvf foo.jar junk
          added manifest
          adding: junk(in = 5) (out= 7)(deflated -40%)
          + /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar
          + /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar
          Corrupted pack file: magic/ver = CAFED00D/160.1 should be CAFED00D/150.7

          + echo demonstrate how to fix this
          demonstrate how to fix this
          + printf public class Foo{}
          + /usr/jdk/instances/jdk1.6.0/bin/javac -target 5 Foo.java
          + jar uvf foo.jar Foo.class
          adding: Foo.class(in = 180) (out= 152)(deflated 15%)
          + rm -f bar.jar
          + /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar
          + /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar
          + [ -f bar.jar ]
          + printf It worked\n
          It worked
          Show
          ksrini Kumar Srinivasan added a comment - BT2:WORK AROUND add a null class as shown below compiled with -target 5. The test script: % cat doit #!/bin/sh -x echo "create a failure case" echo "Junk" > junk jar cvf foo.jar junk /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar echo "demonstrate how to fix this" printf "public class Foo{}" > Foo.java /usr/jdk/instances/jdk1.6.0/bin/javac -target 5 Foo.java jar uvf foo.jar Foo.class rm -f bar.jar /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar if [ -f bar.jar ]; then   printf "It worked\n" fi % ./doit + echo create a failure case create a failure case + echo Junk + jar cvf foo.jar junk added manifest adding: junk(in = 5) (out= 7)(deflated -40%) + /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar + /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar Corrupted pack file: magic/ver = CAFED00D/160.1 should be CAFED00D/150.7 + echo demonstrate how to fix this demonstrate how to fix this + printf public class Foo{} + /usr/jdk/instances/jdk1.6.0/bin/javac -target 5 Foo.java + jar uvf foo.jar Foo.class adding: Foo.class(in = 180) (out= 152)(deflated 15%) + rm -f bar.jar + /usr/jdk/instances/jdk1.6.0/bin/pack200 foo.jar.pack.gz foo.jar + /usr/jdk/instances/jdk1.5.0/bin/unpack200 foo.jar.pack.gz bar.jar + [ -f bar.jar ] + printf It worked\n It worked
          Hide
          ksrini Kumar Srinivasan added a comment -
          BT2:EVALUATION

          The trouble here is that Jar-file does not contain any classes so the 1.6 pack200
          generates a java6 compatible class, one can add a dummy class compiled with -target 5. Simple annotating JARs which are devoid of any classes should not use pack200
          and instead rely on http-compression using gzip.
          The above behavior and deployment strategies are described here:
          http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/pack200.html

          See the workaround section for more info.
          Show
          ksrini Kumar Srinivasan added a comment - BT2:EVALUATION The trouble here is that Jar-file does not contain any classes so the 1.6 pack200 generates a java6 compatible class, one can add a dummy class compiled with -target 5. Simple annotating JARs which are devoid of any classes should not use pack200 and instead rely on http-compression using gzip. The above behavior and deployment strategies are described here: http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/pack200.html See the workaround section for more info.

            People

            • Assignee:
              ksrini Kumar Srinivasan
              Reporter:
              ndcosta Nelson Dcosta
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: