[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Thu Jan 8 09:59:02 2004
PatchSet 4298
Date: 2004/01/08 17:55:55
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath
2004-01-08 Dalibor Topic <robilad@kaffe.org>
Resynced with GNU Classpath.
2004-01-04 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/jar/Connection.java
(Connection): Made class final.
(Connection): Made constructor protected.
(getJarFile): Check doInput.
(getInputStream): Likewise.
Members:
ChangeLog:1.1885->1.1886
libraries/javalib/gnu/java/net/protocol/jar/Connection.java:1.2->1.3
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1885 kaffe/ChangeLog:1.1886
--- kaffe/ChangeLog:1.1885 Thu Jan 8 17:38:57 2004
+++ kaffe/ChangeLog Thu Jan 8 17:55:55 2004
@@ -2,6 +2,18 @@
Resynced with GNU Classpath.
+ 2004-01-04 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/jar/Connection.java
+ (Connection): Made class final.
+ (Connection): Made constructor protected.
+ (getJarFile): Check doInput.
+ (getInputStream): Likewise.
+
+2004-01-08 Dalibor Topic <robilad@kaffe.org>
+
+ Resynced with GNU Classpath.
+
2004-01-06 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/file/Connection.java
Index: kaffe/libraries/javalib/gnu/java/net/protocol/jar/Connection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/jar/Connection.java:1.2 kaffe/libraries/javalib/gnu/java/net/protocol/jar/Connection.java:1.3
--- kaffe/libraries/javalib/gnu/java/net/protocol/jar/Connection.java:1.2 Wed Dec 3 20:40:24 2003
+++ kaffe/libraries/javalib/gnu/java/net/protocol/jar/Connection.java Thu Jan 8 17:55:57 2004
@@ -44,6 +44,7 @@
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
+import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Hashtable;
@@ -57,7 +58,7 @@
*
* @author Kresten Krab Thorup <krab@gnu.org>
*/
-public class Connection extends JarURLConnection
+public final class Connection extends JarURLConnection
{
private JarFile jar_file;
private JarEntry jar_entry;
@@ -120,17 +121,18 @@
}
}
- public Connection(URL url)
+ protected Connection(URL url)
throws MalformedURLException
{
super(url);
}
-
- public void connect() throws IOException
+
+ public synchronized void connect() throws IOException
{
+ // Call is ignored if already connected.
if (connected)
return;
-
+
jar_url = getJarFileURL();
jar_file = JarFileCache.get (jar_url);
String entry_name = getEntryName();
@@ -143,29 +145,35 @@
if(jar_entry == null)
throw new IOException ("No entry for " + entry_name + " exists.");
}
-
+
connected = true;
}
-
- public JarFile getJarFile() throws IOException
- {
- if (!connected)
- connect();
-
- return jar_file;
- }
-
+
public InputStream getInputStream() throws IOException
{
if (!connected)
connect();
+
+ if (! doInput)
+ throw new ProtocolException("Can't open InputStream if doInput is false");
if (jar_entry == null)
throw new IOException (jar_url + " couldn't be found.");
return jar_file.getInputStream (jar_entry);
}
-
+
+ public synchronized JarFile getJarFile() throws IOException
+ {
+ if (!connected)
+ connect();
+
+ if (! doInput)
+ throw new ProtocolException("Can't open JarFile if doInput is false");
+
+ return jar_file;
+ }
+
public int getContentLength()
{
if (!connected)