diff options
| author | Mark Wielaard <mark@klomp.org> | 2005-02-02 17:05:10 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2005-02-02 17:05:10 +0000 |
| commit | cf0616a119e41e7bd1922eefc6143d2990d282ea (patch) | |
| tree | e8357247979b61290e0f06149902bbb432da3354 /gnu/java/net/protocol/jar/Connection.java | |
| parent | bb712951a11b52d1eab200ceb4d815bb355bb9c7 (diff) | |
| download | classpath-cf0616a119e41e7bd1922eefc6143d2990d282ea.tar.gz | |
* gnu/java/net/protocol/jar/Connection.java (is_trying): Removed
field.
(get): Don't use or set is_trying.
Diffstat (limited to 'gnu/java/net/protocol/jar/Connection.java')
| -rw-r--r-- | gnu/java/net/protocol/jar/Connection.java | 67 |
1 files changed, 27 insertions, 40 deletions
diff --git a/gnu/java/net/protocol/jar/Connection.java b/gnu/java/net/protocol/jar/Connection.java index 29b8bd694..1ea708071 100644 --- a/gnu/java/net/protocol/jar/Connection.java +++ b/gnu/java/net/protocol/jar/Connection.java @@ -1,5 +1,5 @@ /* Connection - jar url connection for java.net - Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -68,7 +68,6 @@ public final class Connection extends JarURLConnection { private static Hashtable cache = new Hashtable(); private static final int READBUFSIZE = 4*1024; - private static boolean is_trying = false; public static synchronized JarFile get (URL url) throws IOException { @@ -77,45 +76,33 @@ public final class Connection extends JarURLConnection if (jf != null) return jf; - if (is_trying) - return null; - - try - { - is_trying = true; - - if ("file".equals (url.getProtocol())) - { - File f = new File (url.getFile()); - jf = new JarFile (f, true, ZipFile.OPEN_READ); - } - else - { - URLConnection urlconn = url.openConnection(); - InputStream is = urlconn.getInputStream(); - byte[] buf = new byte [READBUFSIZE]; - File f = File.createTempFile ("cache", "jar"); - FileOutputStream fos = new FileOutputStream (f); - int len = 0; - - while ((len = is.read (buf)) != -1) - { - fos.write (buf, 0, len); - } - - fos.close(); - // Always verify the Manifest, open read only and delete when done. - // XXX ZipFile.OPEN_DELETE not yet implemented. - // jf = new JarFile (f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); - jf = new JarFile (f, true, ZipFile.OPEN_READ); - } + if ("file".equals (url.getProtocol())) + { + File f = new File (url.getFile()); + jf = new JarFile (f, true, ZipFile.OPEN_READ); + } + else + { + URLConnection urlconn = url.openConnection(); + InputStream is = urlconn.getInputStream(); + byte[] buf = new byte [READBUFSIZE]; + File f = File.createTempFile ("cache", "jar"); + FileOutputStream fos = new FileOutputStream (f); + int len = 0; + + while ((len = is.read (buf)) != -1) + { + fos.write (buf, 0, len); + } + + fos.close(); + // Always verify the Manifest, open read only and delete when done. + // XXX ZipFile.OPEN_DELETE not yet implemented. + // jf = new JarFile (f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); + jf = new JarFile (f, true, ZipFile.OPEN_READ); + } - cache.put (url, jf); - } - finally - { - is_trying = false; - } + cache.put (url, jf); return jf; } |
