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

Regression: ZipOutputStream sometimes omits "data descriptor"

XMLWordPrintable

    • b53
    • 6
    • b59
    • generic, x86
    • generic, solaris_9
    • Verified

      Testsuite: JCK 6.0 b08
      Test: api/java_util/jar/Pack200/distributed/index.html#PackDistributed
      Failed: mustang b53, b54 SunOS stt-26 5.9 Generic_117172-07 i86pc i386 i86pc;
                               ( also Windows XP Home, SLES, ...)
      Passed: mustang b52 SunOS stt-26 5.9 Generic_117172-07 i86pc i386 i86pc;
      Attaches: sample4.jar ( just jar file ), Test1Pack.java ( modified testcase from JCK for
       bug reproducing )
      Description:

      invocation of method:
          public void unpack004() {
              try {
                  String testDirURL = "file:///set/stt/jck_workspace/manual_run/dg159268_runs/failed_tests/b53/Pack200/";
                  String fname = "sample4.jar";

                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
                  Pack200.Packer p200 = Pack200.newPacker();
                  java.util.SortedMap p = p200.properties();
                  p.put(p200.EFFORT, new Integer(0).toString());

                  System.out.println("PACK ...");
                  URL file = new URL(new URL(testDirURL), fname);
                  URLConnection uc = file.openConnection();
                  JarInputStream jis = new JarInputStream(uc.getInputStream());
                  p200.pack(jis, baos);

                  System.out.println("UNPACK ...");
                  byte [] packed_array = baos.toByteArray();
                  System.out.println("Length=" + packed_array.length);
                  ByteArrayInputStream bis =
                      new ByteArrayInputStream(packed_array);
                  System.out.println("avail=" + bis.available());

                  ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
                  JarOutputStream jos = new JarOutputStream(baos);

                  (Pack200.newUnpacker()).unpack(bis, jos);
                  jos.flush();
                  jos.close();

              } catch (IOException ioe) {
                  ioe.printStackTrace(System.out);
                  System.out.println("Unexpected " + ioe);
                  return ;
              }
              System.out.println("Passed OK");
              return;
         } // End of unpack004()

      cause error:
      --------------------
      PACK ...
      UNPACK ...
      Length=11207
      avail=11207
      java.util.zip.ZipException: invalid entry size (expected 1758920712 but got 943 bytes)
              at java.util.zip.ZipInputStream.readEnd(Unknown Source)
              at java.util.zip.ZipInputStream.read(Unknown Source)
              at java.util.jar.JarInputStream.read(Unknown Source)
              at java.io.FilterInputStream.read(Unknown Source)
              at com.sun.java.util.jar.pack.Utils.copyJarFile(Unknown Source)
              at com.sun.java.util.jar.pack.UnpackerImpl.unpack(Unknown Source)
              at Test1Pack200.unpack004(Test1Pack200.java:61)
              at Test1Pack200.main(Test1Pack200.java:77)
      Unexpected java.util.zip.ZipException: invalid entry size (expected 1758920712 but got 943 bytes)
      --------------------------

      For JDK 6.0 b52 output is:
      --------------------------
      PACK ...
      UNPACK ...
      Length=11287
      avail=11287
      Passed OK
      --------------------------

      This test passed when we working with jarFile ( not InputStream from URLConnection ) as
      // *** JarFile jarFile = new JarFile("./sample4.jar");
      // *** p200.pack(jarFile, baos);
      // *** jarFile.close();
      And there is no error if we using not 0 for EFFORT property:
      // p.put(p200.EFFORT, new Integer(5).toString());

            bristor Dave Bristor (Inactive)
            dgubkin Dmitriy Gubkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: