--- /home/cpdev/src/classpath/java/util/zip/ZipFile.java	2005-07-02 21:03:49.000000000 +0000
+++ java/util/zip/ZipFile.java	2005-06-30 05:34:52.000000000 +0000
@@ -1,6 +1,5 @@
 /* ZipFile.java --
-   Copyright (C) 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,8 +38,6 @@
 
 package java.util.zip;
 
-import gnu.java.util.EmptyEnumeration;
-
 import java.io.BufferedInputStream;
 import java.io.DataInput;
 import java.io.EOFException;
@@ -97,7 +94,6 @@
   {
     this.raf = new RandomAccessFile(name, "r");
     this.name = name;
-    checkZipFile();
   }
 
   /**
@@ -110,7 +106,6 @@
   {
     this.raf = new RandomAccessFile(file, "r");
     this.name = file.getPath();
-    checkZipFile();
   }
 
   /**
@@ -137,28 +132,6 @@
       file.deleteOnExit();
     this.raf = new RandomAccessFile(file, "r");
     this.name = file.getPath();
-    checkZipFile();
-  }
-
-  private void checkZipFile() throws IOException, ZipException
-  {
-    byte[] magicBuf = new byte[4];
-    raf.read(magicBuf);
-
-    if (readLeInt(magicBuf, 0) != LOCSIG)
-      {
-	raf.close();
-	throw new ZipException("Not a valid zip file");
-      }
-  }
-
-  /**
-   * Checks if file is closed and throws an exception.
-   */
-  private void checkClosed()
-  {
-    if (closed)
-      throw new IllegalStateException("ZipFile has closed: " + name);
   }
 
   /**
@@ -336,20 +309,16 @@
 
   /**
    * Returns an enumeration of all Zip entries in this Zip file.
-   *
-   * @exception IllegalStateException when the ZipFile has already been closed
    */
   public Enumeration entries()
   {
-    checkClosed();
-    
     try
       {
 	return new ZipEntryEnumeration(getEntries().values().iterator());
       }
     catch (IOException ioe)
       {
-	return EmptyEnumeration.getInstance();
+	return null;
       }
   }
 
@@ -363,7 +332,8 @@
   {
     synchronized(raf)
       {
-	checkClosed();
+	if (closed)
+	  throw new IllegalStateException("ZipFile has closed: " + name);
 
 	if (entries == null)
 	  readEntries();
@@ -378,21 +348,14 @@
    * @param the name. May contain directory components separated by
    * slashes ('/').
    * @return the zip entry, or null if no entry with that name exists.
-   *
-   * @exception IllegalStateException when the ZipFile has already been closed
    */
   public ZipEntry getEntry(String name)
   {
-    checkClosed();
-
     try
       {
 	HashMap entries = getEntries();
 	ZipEntry entry = (ZipEntry) entries.get(name);
-        // If we didn't find it, maybe it's a directory.
-        if (entry == null && !name.endsWith("/"))
-            entry = (ZipEntry) entries.get(name + '/');
-	return entry != null ? new ZipEntry(entry, name) : null;
+	return entry != null ? (ZipEntry) entry.clone() : null;
       }
     catch (IOException ioe)
       {
@@ -454,14 +417,11 @@
    * @param entry the entry to create an InputStream for.
    * @return the input stream, or null if the requested entry does not exist.
    *
-   * @exception IllegalStateException when the ZipFile has already been closed
    * @exception IOException if a i/o error occured.
    * @exception ZipException if the Zip archive is malformed.  
    */
   public InputStream getInputStream(ZipEntry entry) throws IOException
   {
-    checkClosed();
-
     HashMap entries = getEntries();
     String name = entry.getName();
     ZipEntry zipEntry = (ZipEntry) entries.get(name);
@@ -493,13 +453,9 @@
 
   /**
    * Returns the number of entries in this zip file.
-   *
-   * @exception IllegalStateException when the ZipFile has already been closed
    */
   public int size()
   {
-    checkClosed();
-    
     try
       {
 	return getEntries().size();
