diff options
| author | Tom Tromey <tromey@redhat.com> | 2005-09-20 21:01:44 +0000 |
|---|---|---|
| committer | Tom Tromey <tromey@redhat.com> | 2005-09-20 21:01:44 +0000 |
| commit | 0af6ac2f382570befc8619c676342af09a02139f (patch) | |
| tree | f601d03ce6995d7294f8ec836c1fe2bc4634f62b /gnu/java/net/protocol/jar/Connection.java | |
| parent | b93a9d590593a8e83121119e913f4f9bd5c971fd (diff) | |
| download | classpath-0af6ac2f382570befc8619c676342af09a02139f.tar.gz | |
PR classpath/22906:
* gnu/java/net/protocol/jar/Connection.java (get): Added useCaches
argument.
(connect): Updated.
Diffstat (limited to 'gnu/java/net/protocol/jar/Connection.java')
| -rw-r--r-- | gnu/java/net/protocol/jar/Connection.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gnu/java/net/protocol/jar/Connection.java b/gnu/java/net/protocol/jar/Connection.java index bd7a80da7..e85487420 100644 --- a/gnu/java/net/protocol/jar/Connection.java +++ b/gnu/java/net/protocol/jar/Connection.java @@ -69,13 +69,17 @@ public final class Connection extends JarURLConnection 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 @@ public final class Connection extends JarURLConnection 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 @@ public final class Connection extends JarURLConnection 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 |
