[kaffe] CVS kaffe (robilad): resynced with gnu classpath: http fix

Kaffe CVS cvs-commits at kaffe.org
Sun May 29 17:46:20 PDT 2005


PatchSet 6590 
Date: 2005/05/30 00:37:41
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: http fix

Members: 
	ChangeLog:1.4116->1.4117 
	libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.8->1.9 
	libraries/javalib/gnu/java/net/protocol/http/Request.java:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4116 kaffe/ChangeLog:1.4117
--- kaffe/ChangeLog:1.4116	Mon May 30 00:14:13 2005
+++ kaffe/ChangeLog	Mon May 30 00:37:41 2005
@@ -1,5 +1,25 @@
 2005-05-30  Dalibor Topic  <robilad at kaffe.org>
 
+        Resynced with GNU Classpath.
+	
+	2005-05-26  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+	* gnu/java/net/protocol/http/HTTPURLConnection.java:
+	(connect()): Reverted the removal of the exception
+	with 404s.
+
+	2005-05-26  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+	* gnu/java/net/protocol/http/HTTPURLConnection.java:
+	(connect()): Fixed a null pointer exception with 304
+	responses and an inappropriate exception with 404s.
+	* gnu/java/net/protocol/http/Request.java:
+	(readResponse(java.io.LineInputStream)): Fixed a
+	fruitless attempt to read the non-existant body
+	of a 304 response.
+
+2005-05-30  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/kaffe-gc/gc-incremental.c:
 	Fixed compile problems with JVMPI.
 
Index: kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.8 kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.9
--- kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java:1.8	Sun May 15 10:16:37 2005
+++ kaffe/libraries/javalib/gnu/java/net/protocol/http/HTTPURLConnection.java	Mon May 30 00:37:45 2005
@@ -233,82 +233,82 @@
           {
             // Follow redirect
             String location = response.getHeader("Location");
-            String connectionUri = connection.getURI();
-            int start = connectionUri.length();
-            if (location.startsWith(connectionUri) &&
-                location.charAt(start) == '/')
-              {
-                file = location.substring(start);
-                retry = true;
-              }
-            else if (location.startsWith("http:"))
-              {
-                connection.close();
-                connection = null;
-                secure = false;
-                start = 7;
-                int end = location.indexOf('/', start);
-                host = location.substring(start, end);
-                int ci = host.lastIndexOf(':');
-                if (ci != -1)
-                  {
-                    port = Integer.parseInt(host.substring (ci + 1));
-                    host = host.substring(0, ci);
-                  }
-                else
-                  {
-                    port = HTTPConnection.HTTP_PORT;
-                  }
-                file = location.substring(end);
-                retry = true;
-              }
-            else if (location.startsWith("https:"))
-              {
-                connection.close();
-                connection = null;
-                secure = true;
-                start = 8;
-                int end = location.indexOf('/', start);
-                host = location.substring(start, end);
-                int ci = host.lastIndexOf(':');
-                if (ci != -1)
-                  {
-                    port = Integer.parseInt(host.substring (ci + 1));
-                    host = host.substring(0, ci);
-                  }
-                else
-                  {
-                    port = HTTPConnection.HTTPS_PORT;
-                  }
-                file = location.substring(end);
-                retry = true;
-              }
-	    else if (location.length() > 0)
+	    if (location != null)
 	      {
-		// Malformed absolute URI, treat as file part of URI
-		if (location.charAt(0) == '/')
+		String connectionUri = connection.getURI();
+		int start = connectionUri.length();
+		if (location.startsWith(connectionUri) &&
+		    location.charAt(start) == '/')
 		  {
-		    // Absolute path
-		    file = location;
+		    file = location.substring(start);
+		    retry = true;
 		  }
-		else
+		else if (location.startsWith("http:"))
 		  {
-		    // Relative path
-		    int lsi = file.lastIndexOf('/');
-		    file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
+		    connection.close();
+		    connection = null;
+		    secure = false;
+		    start = 7;
+		    int end = location.indexOf('/', start);
+		    host = location.substring(start, end);
+		    int ci = host.lastIndexOf(':');
+		    if (ci != -1)
+		      {
+			port = Integer.parseInt(host.substring (ci + 1));
+			host = host.substring(0, ci);
+		      }
+		    else
+		      {
+			port = HTTPConnection.HTTP_PORT;
+		      }
+		    file = location.substring(end);
+		    retry = true;
+		  }
+		else if (location.startsWith("https:"))
+		  {
+		    connection.close();
+		    connection = null;
+		    secure = true;
+		    start = 8;
+		    int end = location.indexOf('/', start);
+		    host = location.substring(start, end);
+		    int ci = host.lastIndexOf(':');
+		    if (ci != -1)
+		      {
+			port = Integer.parseInt(host.substring (ci + 1));
+			host = host.substring(0, ci);
+		      }
+		    else
+		      {
+			port = HTTPConnection.HTTPS_PORT;
+		      }
+		    file = location.substring(end);
+		    retry = true;
+		  }
+		else if (location.length() > 0)
+		  {
+		    // Malformed absolute URI, treat as file part of URI
+		    if (location.charAt(0) == '/')
+		      {
+			// Absolute path
+			file = location;
+		      }
+		    else
+		      {
+			// Relative path
+			int lsi = file.lastIndexOf('/');
+			file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
 		    file += location;
+		      }
+		    retry = true;
 		  }
-		retry = true;
 	      }
           }
         else
           {
             responseSink = new ByteArrayInputStream(reader.toByteArray ());
             if (response.getCode() == 404)
-              {
-                errorSink = responseSink;
-                throw new FileNotFoundException(url.toString());
-              }
+	      errorSink = responseSink;
           }
       }
     while (retry);
Index: kaffe/libraries/javalib/gnu/java/net/protocol/http/Request.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/http/Request.java:1.3 kaffe/libraries/javalib/gnu/java/net/protocol/http/Request.java:1.4
--- kaffe/libraries/javalib/gnu/java/net/protocol/http/Request.java:1.3	Tue Mar  8 21:03:51 2005
+++ kaffe/libraries/javalib/gnu/java/net/protocol/http/Request.java	Mon May 30 00:37:45 2005
@@ -448,6 +448,7 @@
       {
       case 204:
       case 205:
+      case 304:
         break;
       default:
         // Does response body reader want body?




More information about the kaffe mailing list