This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: more protocol fun in URL


Mark came up with the patch to not change the protocol handler when not
required.  My addition was proper case conversion.  Ok for HEAD (and
Classpath)?


2004-07-03  Mark Wielaard  <mark@klomp.org>
            Anthony Green  <green@redhat.com>

	* java/net/URL.java: (set): Convert protocol to lower case before
	doing anything.
	Only change the protocol handler if it's different.


Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.37
diff -c -u -p -r1.37 URL.java
--- java/net/URL.java	3 May 2004 20:23:26 -0000	1.37
+++ java/net/URL.java	3 Jul 2004 14:22:05 -0000
@@ -699,8 +700,12 @@ public final class URL implements Serial
     // invalid protocol.  It will cause the handler to be set to null
     // thus overriding a valid handler.  Callers of this method should
     // be aware of this.
-    this.ph = getURLStreamHandler(protocol);
-    this.protocol = protocol.toLowerCase();
+    protocol = protocol.toLowerCase ();
+    if (! this.protocol.equals (protocol))
+      {
+	this.ph = getURLStreamHandler(protocol);
+	this.protocol = protocol;
+      }
     this.authority = "";
     this.port = port;
     this.host = host;
@@ -738,8 +743,12 @@ public final class URL implements Serial
     // invalid protocol.  It will cause the handler to be set to null
     // thus overriding a valid handler.  Callers of this method should
     // be aware of this.
-    this.ph = getURLStreamHandler(protocol);
-    this.protocol = protocol.toLowerCase();
+    protocol = protocol.toLowerCase ();
+    if (! this.protocol.equals (protocol))
+      {
+	this.ph = getURLStreamHandler(protocol);
+	this.protocol = protocol;
+      }
     this.host = host;
     this.userInfo = userInfo;
     this.port = port;



AG

-- 
Anthony Green <green@redhat.com>
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]