This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: more protocol fun in URL
- From: Anthony Green <green at redhat dot com>
- To: java-patches at gcc dot gnu dot org, Mark Wielaard <mark at klomp dot org>
- Date: Sat, 03 Jul 2004 07:25:37 -0700
- Subject: Patch: more protocol fun in URL
- Organization: Red Hat, Inc.
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.