diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | java/util/jar/JarFile.java | 19 | ||||
-rw-r--r-- | java/util/zip/InflaterInputStream.java | 3 | ||||
-rw-r--r-- | java/util/zip/ZipInputStream.java | 2 |
4 files changed, 28 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2003-02-03 John Leuner <jewel@debian.org> + * java/util/zip/InflaterInputStream.java: fix problem with 0-length + reads from end of file + * java/util/zip/ZipInputStream.java: idem + * java/util/jar/JarFile.java: read manifest + 2003-02-02 C. Brian Jones <cbj@gnu.org> * doc/www.gnu.org/home.wml: add Jikes RVM to list of JVMs; update diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java index d6fd9846b..895761302 100644 --- a/java/util/jar/JarFile.java +++ b/java/util/jar/JarFile.java @@ -71,10 +71,10 @@ public class JarFile extends ZipFile */ private Manifest manifest; - /** Wether to verify the manifest and all entries. */ + /** Whether to verify the manifest and all entries. */ private boolean verify; - /** Wether the has already been loaded. */ + /** Whether the has already been loaded. */ private boolean manifestRead = false; // Constructors @@ -109,6 +109,10 @@ public class JarFile extends ZipFile FileNotFoundException, IOException { super(fileName); + if (verify) { + manifest = readManifest(); + verify(); + } } /** @@ -141,6 +145,10 @@ public class JarFile extends ZipFile IOException { super(file); + if (verify) { + manifest = readManifest(); + verify(); + } } /** @@ -165,6 +173,10 @@ public class JarFile extends ZipFile FileNotFoundException, IOException, IllegalArgumentException { super(file, mode); + if (verify) { + manifest = readManifest(); + verify(); + } } // Methods @@ -196,15 +208,18 @@ public class JarFile extends ZipFile if (manEntry != null) { InputStream in = super.getInputStream(manEntry); + manifestRead = true; return new Manifest(in); } else { + manifestRead = true; return null; } } catch (IOException ioe) { + manifestRead = true; return null; } } diff --git a/java/util/zip/InflaterInputStream.java b/java/util/zip/InflaterInputStream.java index 6c72161d2..aa8a01b4c 100644 --- a/java/util/zip/InflaterInputStream.java +++ b/java/util/zip/InflaterInputStream.java @@ -182,6 +182,9 @@ public class InflaterInputStream extends FilterInputStream { */ public int read(byte[] b, int off, int len) throws IOException { + + if (len == 0) return 0; + for (;;) { int count; diff --git a/java/util/zip/ZipInputStream.java b/java/util/zip/ZipInputStream.java index c4905978d..789a7c60e 100644 --- a/java/util/zip/ZipInputStream.java +++ b/java/util/zip/ZipInputStream.java @@ -286,6 +286,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants */ public int read(byte[] b, int off, int len) throws IOException { + if(len == 0) + return 0; if (crc == null) throw new IOException("Stream closed."); if (entry == null) |