From 8f523f3a1047919d3563daf1ef47ba87336ebe89 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 15 Nov 2005 23:20:01 +0000 Subject: Imported GNU Classpath 0.19 + gcj-import-20051115. * sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049 --- libjava/classpath/java/util/zip/PendingBuffer.java | 2 +- libjava/classpath/java/util/zip/ZipFile.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'libjava/classpath/java/util/zip') diff --git a/libjava/classpath/java/util/zip/PendingBuffer.java b/libjava/classpath/java/util/zip/PendingBuffer.java index dd7ed10..9079b98 100644 --- a/libjava/classpath/java/util/zip/PendingBuffer.java +++ b/libjava/classpath/java/util/zip/PendingBuffer.java @@ -183,7 +183,7 @@ class PendingBuffer /** * Flushes the pending buffer and returns that data in a new array * - * @param output the output stream + * @return the output stream */ public final byte[] toByteArray() diff --git a/libjava/classpath/java/util/zip/ZipFile.java b/libjava/classpath/java/util/zip/ZipFile.java index 0243abe..4be845e 100644 --- a/libjava/classpath/java/util/zip/ZipFile.java +++ b/libjava/classpath/java/util/zip/ZipFile.java @@ -144,9 +144,18 @@ public class ZipFile implements ZipConstants private void checkZipFile() throws IOException, ZipException { byte[] magicBuf = new byte[4]; - raf.read(magicBuf); + boolean validRead = true; - if (readLeInt(magicBuf, 0) != LOCSIG) + try + { + raf.readFully(magicBuf); + } + catch (EOFException eof) + { + validRead = false; + } + + if (validRead == false || readLeInt(magicBuf, 0) != LOCSIG) { raf.close(); throw new ZipException("Not a valid zip file"); @@ -377,7 +386,7 @@ public class ZipFile implements ZipConstants * Checks that the ZipFile is still open and reads entries when necessary. * * @exception IllegalStateException when the ZipFile has already been closed. - * @exception IOEexception when the entries could not be read. + * @exception IOException when the entries could not be read. */ private HashMap getEntries() throws IOException { @@ -395,7 +404,7 @@ public class ZipFile implements ZipConstants /** * Searches for a zip entry in this archive with the given name. * - * @param the name. May contain directory components separated by + * @param name the name. May contain directory components separated by * slashes ('/'). * @return the zip entry, or null if no entry with that name exists. * -- cgit v1.1