[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Wed Dec 3 12:43:09 PST 2003


PatchSet 4185 
Date: 2003/12/03 20:33:37
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath

2003-12-03  Dalibor Topic <robilad at kaffe.org>
        * libraries/javalib/gnu/java/net/protocol/file/Handler.java,
        libraries/javalib/gnu/java/net/protocol/http/Connection.java:
        Resynced with GNU Classpath.

        2003-12-02  Michael Koch  <konqueror at gmx.de>

        * gnu/java/net/protocol/file/Handler.java:
        (openConnection): Handle case when host part of file: URL is set.
        * gnu/java/net/protocol/http/Connection.java: Reformated.

        2003-11-27  Michael Koch  <konqueror at gmx.de>

        * gnu/java/net/protocol/http/Connection.java
        (connect): Always create outputStream, its needed to send request to
        remote server. Set connected to true after request was sent and reply
        received.

Members: 
	ChangeLog:1.1776->1.1777 
	libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.1->1.2 
	libraries/javalib/gnu/java/net/protocol/http/Connection.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1776 kaffe/ChangeLog:1.1777
--- kaffe/ChangeLog:1.1776	Wed Dec  3 20:26:03 2003
+++ kaffe/ChangeLog	Wed Dec  3 20:33:37 2003
@@ -1,4 +1,22 @@
 2003-12-03  Dalibor Topic <robilad at kaffe.org>
+	* libraries/javalib/gnu/java/net/protocol/file/Handler.java,
+	libraries/javalib/gnu/java/net/protocol/http/Connection.java:
+	Resynced with GNU Classpath.
+
+	2003-12-02  Michael Koch  <konqueror at gmx.de>
+
+	* gnu/java/net/protocol/file/Handler.java:
+	(openConnection): Handle case when host part of file: URL is set.
+	* gnu/java/net/protocol/http/Connection.java: Reformated.
+
+	2003-11-27  Michael Koch  <konqueror at gmx.de>
+
+	* gnu/java/net/protocol/http/Connection.java
+	(connect): Always create outputStream, its needed to send request to
+	remote server. Set connected to true after request was sent and reply
+	received.
+
+2003-12-03  Dalibor Topic <robilad at kaffe.org>
 
 	* libraries/javalib/gnu/java/net/protocol/file/Connection.java:
 	Resynced with GNU Classpath.
Index: kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.1 kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.2
--- kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.1	Wed Oct 29 18:30:50 2003
+++ kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java	Wed Dec  3 20:33:39 2003
@@ -70,10 +70,27 @@
    *
    * @exception IOException If an error occurs
    */
-  protected URLConnection openConnection (URL url)
-    throws IOException
+  protected URLConnection openConnection(URL url) throws IOException
   {
-    return new Connection (url);
+    // If a hostname is set, then we need to switch protocols to ftp
+    // in order to transfer this from the remote host.
+    String host = url.getHost();
+    if ((host != null) && (! host.equals("")))
+      {
+        throw new IOException("ftp protocol handler not yet implemented.");
+        /*
+	// Reset the protocol (and implicitly the handler) for this URL.
+	// Then have the URL attempt the connection again, as it will
+	// get the changed handler the next time around.
+	setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
+		url.getRef());
+	// Until the ftp protocol handler is written, this will cause
+	// a NullPointerException.
+	return url.openConnection();
+	*/
+      }
+
+    return new Connection(url);
   }
 
   /**
@@ -315,5 +332,4 @@
     
     return sb.toString();
   }
-
 } // class Handler
Index: kaffe/libraries/javalib/gnu/java/net/protocol/http/Connection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/http/Connection.java:1.1 kaffe/libraries/javalib/gnu/java/net/protocol/http/Connection.java:1.2
--- kaffe/libraries/javalib/gnu/java/net/protocol/http/Connection.java:1.1	Wed Oct 29 18:30:50 2003
+++ kaffe/libraries/javalib/gnu/java/net/protocol/http/Connection.java	Wed Dec  3 20:33:39 2003
@@ -75,27 +75,24 @@
    * The socket we are connected to
    */
   private Socket socket;
-  
-  private static String proxyHost = null;
   private static int proxyPort = 80;
   private static boolean proxyInUse = false;
+  private static String proxyHost = null;
 
   static 
   {
     // Recognize some networking properties listed at
     // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
     String port = null;
-    proxyHost = System.getProperty ("http.proxyHost");
-    
+    proxyHost = System.getProperty("http.proxyHost");
     if (proxyHost != null)
       {
 	proxyInUse = true;
-	
-	if ((port = System.getProperty ("http.proxyPort")) != null)
+	if ((port = System.getProperty("http.proxyPort")) != null)
 	  {
 	    try
 	      {
-		proxyPort = Integer.parseInt (port);
+		proxyPort = Integer.parseInt(port);
 	      }
 	    catch (Throwable t)
 	      {
@@ -134,9 +131,9 @@
   /**
    * Calls superclass constructor to initialize
    */
-  protected Connection (URL url)
+  protected Connection(URL url)
   {
-    super (url);
+    super(url);
 
     /* Set up some variables */
     doOutput = false;
@@ -154,34 +151,31 @@
 
     // Get address and port number.
     int port;
-    
     if (proxyInUse)
       {
 	port = proxyPort;
-	socket = new Socket (proxyHost, port);
+	socket = new Socket(proxyHost, port);
       }
     else
       {
 	if ((port = url.getPort()) == -1)
 	  port = 80;
-
 	// Open socket and output stream.
-	socket = new Socket (url.getHost(), port);
+	socket = new Socket(url.getHost(), port);
       }
 
     if (doInput)
-      inputStream
-        = new DataInputStream (new BufferedInputStream (socket.getInputStream()));
-
-    if (doOutput)
-      outputStream = new BufferedOutputStream (socket.getOutputStream());
+      inputStream = new DataInputStream
+	(new BufferedInputStream (socket.getInputStream()));
 
+    outputStream = new BufferedOutputStream (socket.getOutputStream());
     bufferedOutputStream = new ByteArrayOutputStream (256); //default is too small
     outputWriter = new PrintWriter (new OutputStreamWriter (outputStream, "8859_1")); 
-    connected = true;
 
     sendRequest();
     receiveReply();
+
+    connected = true;
   }
 
   /**
@@ -199,7 +193,6 @@
 	  {
 	    // Ignore errors in closing socket.
 	  }
-	
 	socket = null;
       }
   }
@@ -450,5 +443,5 @@
     return bufferedOutputStream;
   }
 
-} // class Connection
 
+}




More information about the kaffe mailing list