JDK-5079423 : JarDiff inserts ZipEntry objects from one jar file directly into a new one
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_2.5.1
  • CPU: x86
  • Submitted: 2004-07-28
  • Updated: 2020-10-03
  • Resolved: 2005-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b50Fixed
Related Reports
Relates :  
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) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
31-08-2004

EVALUATION this is a bug in the sample jnlpDownloadServlet, which contains the jardiff implementation. look into for mustang. ###@###.### 2004-07-28
28-07-2004