From 57b4edef7d295f067c6bb66ba487c40ea9dc3d58 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 27 Oct 2003 11:02:44 +0000 Subject: Reported by Helmer Kraemer Reported by Helmer Kraemer * java/util/jar/JarInputStream.java (readManifest): Don't call closeEntry(). * java/util/zip/DeflaterOutputStream.java (inbufWrite): New method. (finish): Use inbufWrite(). (write(int)): Likewise. (write(byte[],int,int)): Likewise. From-SVN: r72976 --- libjava/ChangeLog | 11 +++++++++ libjava/java/util/jar/JarInputStream.java | 1 - libjava/java/util/zip/DeflaterOutputStream.java | 30 ++++++++++--------------- 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'libjava') diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d4c1981..a7fe99a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,14 @@ +2003-10-26 Mark Wielaard + + Reported by Helmer Kraemer + * java/util/jar/JarInputStream.java (readManifest): Don't call + closeEntry(). + + * java/util/zip/DeflaterOutputStream.java (inbufWrite): New method. + (finish): Use inbufWrite(). + (write(int)): Likewise. + (write(byte[],int,int)): Likewise. + 2003-10-26 Bryce McKinlay * java/lang/reflect/AccessibleObject.java (secureSetAccessible): diff --git a/libjava/java/util/jar/JarInputStream.java b/libjava/java/util/jar/JarInputStream.java index 9c295f3..daf935f 100644 --- a/libjava/java/util/jar/JarInputStream.java +++ b/libjava/java/util/jar/JarInputStream.java @@ -116,7 +116,6 @@ public class JarInputStream extends ZipInputStream } firstEntry = (JarEntry) super.getNextEntry(); } - closeEntry(); if (verify) { diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java index ff66b08..6a4fa95 100644 --- a/libjava/java/util/zip/DeflaterOutputStream.java +++ b/libjava/java/util/zip/DeflaterOutputStream.java @@ -127,12 +127,7 @@ public class DeflaterOutputStream extends FilterOutputStream */ public void finish () throws IOException { - if (inbufLength > 0) - { - def.setInput (inbuf, 0, inbufLength); - deflate (); - inbufLength = 0; - } + inbufWrite(); def.finish(); while (! def.finished ()) { @@ -145,28 +140,27 @@ public class DeflaterOutputStream extends FilterOutputStream public void write (int bval) throws IOException { if (inbuf == null) - { - inbuf = new byte[128]; - } + inbuf = new byte[128]; else if (inbufLength == inbuf.length) - { - def.setInput (inbuf, 0, inbufLength); - deflate (); - inbufLength = 0; - } + inbufWrite (); inbuf[inbufLength++] = (byte) bval; } public void write (byte[] buf, int off, int len) throws IOException { + inbufWrite (); + def.setInput (buf, off, len); + deflate (); + } + + private void inbufWrite () throws IOException + { if (inbufLength > 0) { - def.setInput (inbuf, 0, inbufLength); - deflate (); + int size = inbufLength; inbufLength = 0; + write (inbuf, 0, size); } - def.setInput (buf, off, len); - deflate (); } // Used, if needed, for write(int). -- cgit v1.1