--- /home/cpdev/src/classpath/java/net/JarURLConnection.java	2005-07-02 21:03:35.000000000 +0000
+++ java/net/JarURLConnection.java	2005-06-30 05:34:40.000000000 +0000
@@ -42,7 +42,9 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
 
 
 /**
@@ -151,9 +153,46 @@
    */
   public JarEntry getJarEntry() throws IOException
   {
-    JarFile jarFile = getJarFile();
+    JarFile jarfile = null;
 
-    return jarFile != null ? jarFile.getJarEntry(entryName) : null;
+    if (entryName == null)
+      return null;
+
+    if (! doInput)
+      throw new ProtocolException("Can't open JarEntry if doInput is false");
+
+    try
+      {
+	jarfile = getJarFile ();
+      }
+    catch (IOException x)
+      {
+	/* ignore */
+      }
+    
+    if (jarfile == null)
+      {
+	JarInputStream zis = new JarInputStream(
+			jarFileURLConnection.getInputStream ());
+
+	// This is hideous, we're doing a linear search for the thing...
+	for (ZipEntry ent = zis.getNextEntry (); 
+	     ent != null; 
+	     ent = zis.getNextEntry ())
+	  {
+	    if (entryName.equals (ent.getName()))
+	      {
+		return new JarEntry (ent);
+	      }
+	  }
+      }
+
+    else
+      {
+	return jarfile.getJarEntry (entryName);
+      }
+
+    return null;
   }
 
   /**
