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

JarDiff inserts ZipEntry objects from one jar file directly into a new one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 6
    • Component/s: deploy
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b50
    • CPU:
      x86
    • OS:
      solaris_2.5.1

      Description

      Name: js151677 Date: 07/28/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux baltic 2.6.7-1-686-smp #1 SMP Thu Jul 8 06:08:37 EDT 2004 i686 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      JarDiff reuses ZipEntry objects without properly clearing out their compressed size:

      [From JarDiff.java]:

      while (entries.hasNext()) {
      String newName = (String)entries.next();
      if (_debug) {
      System.out.println("New File: " + newName);
      }
      writeEntry(jos, newJar.getEntryByName(newName), newJar);
      }

      later in writeEntry() we see it directly added to the new jar file:

          private static void writeEntry(JarOutputStream jos, JarEntry entry,
                                  InputStream data) throws IOException {
              jos.putNextEntry(entry);

      If the data compresses to a different size in the new jar file, the ZipOutputStream will fail with an exception: invalid entry compressed size.

      The compressed size should be cleared out before reusing the ZipEntry.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Attempt to create a jardiff of jar files created with a non-standard compression level.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Before creating a jardiff the two source jar files can be recreated completely with the same JVM version that will be used to perform the jardiff.
      (Incident Review ID: 290083)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jchusunw Jacky Chu (Inactive)
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: