diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
commit | 3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/java/util/zip/ZipFile.java | |
parent | 7e55c49d7d91ef9f09e93c1100119b1ab3652446 (diff) | |
download | ppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.tar.gz ppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.zip |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/util/zip/ZipFile.java')
-rw-r--r-- | libjava/classpath/java/util/zip/ZipFile.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libjava/classpath/java/util/zip/ZipFile.java b/libjava/classpath/java/util/zip/ZipFile.java index 0243abed1f8..4be845ea781 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. * |