classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: PR 22906


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: PR 22906
Date: 20 Sep 2005 14:55:06 -0600

I'm checking this in.

This fixes PR classpath/22906.  The jar URL handler was not properly
respecting the do-not-cache flag.  I did see the patch in the PR but I
wrote this one myself.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>
        PR classpath/22906:
        * gnu/java/net/protocol/jar/Connection.java (get): Added useCaches
        argument.
        (connect): Updated.

Index: gnu/java/net/protocol/jar/Connection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Connection.java,v
retrieving revision 1.9
diff -u -r1.9 Connection.java
--- gnu/java/net/protocol/jar/Connection.java   2 Jul 2005 20:32:13 -0000       
1.9
+++ gnu/java/net/protocol/jar/Connection.java   20 Sep 2005 20:57:40 -0000
@@ -69,13 +69,17 @@
     private static Hashtable cache = new Hashtable();
     private static final int READBUFSIZE = 4*1024;
     
-    public static synchronized JarFile get (URL url) throws IOException
+    public static synchronized JarFile get (URL url, boolean useCaches)
+       throws IOException
     {
-      JarFile jf = (JarFile) cache.get (url);
+      JarFile jf;
+      if (useCaches)
+        {
+          jf = (JarFile) cache.get (url);
+          if (jf != null)
+            return jf;
+        }
 
-      if (jf != null)
-        return jf;
-      
       if ("file".equals (url.getProtocol()))
        {
          File f = new File (url.getFile());
@@ -100,9 +104,10 @@
          jf = new JarFile (f, true,
                            ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
        }
-          
-      cache.put (url, jf);
-      
+
+      if (useCaches)
+        cache.put (url, jf);
+
       return jf;
     }
   }
@@ -120,7 +125,7 @@
       return;
 
     jar_url = getJarFileURL();
-    jar_file = JarFileCache.get (jar_url);
+    jar_file = JarFileCache.get (jar_url, useCaches);
     String entry_name = getEntryName();
     
     if (entry_name != null




reply via email to

[Prev in Thread] Current Thread [Next in Thread]