[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch: more protocol fun in URL
From: |
Mark Wielaard |
Subject: |
Re: Patch: more protocol fun in URL |
Date: |
Sun, 04 Jul 2004 14:24:02 +0200 |
Hi,
On Sat, 2004-07-03 at 16:25, Anthony Green wrote:
> 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 <address@hidden>
> Anthony Green <address@hidden>
>
> * java/net/URL.java: (set): Convert protocol to lower case before
> doing anything.
> Only change the protocol handler if it's different.
This one didn't apply cleanly to GNU Classpath CVS. So I committed a
slightly different one (attached). I'll try to merge java/net/URL.java
with libgcj later.
Cheers,
Mark
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v
retrieving revision 1.32
diff -u -r1.32 URL.java
--- java/net/URL.java 4 Jul 2004 12:02:40 -0000 1.32
+++ java/net/URL.java 4 Jul 2004 12:18:57 -0000
@@ -703,14 +703,17 @@
protected void set(String protocol, String host, int port, String file,
String ref)
{
- URLStreamHandler protocolHandler = getURLStreamHandler(protocol);
+ URLStreamHandler protocolHandler = null;
+ protocol = protocol.toLowerCase();
+ if (! this.protocol.equals(protocol))
+ protocolHandler = getURLStreamHandler(protocol);
// It is an hidden feature of the JDK. If the protocol does not exist,
// we keep the previously initialized protocol.
if (protocolHandler != null)
{
- this.ph = protocolHandler;
- this.protocol = protocol.toLowerCase();
+ this.ph = protocolHandler;
+ this.protocol = protocol;
}
this.authority = "";
this.port = port;
@@ -746,14 +749,17 @@
protected void set(String protocol, String host, int port, String authority,
String userInfo, String path, String query, String ref)
{
- URLStreamHandler protocolHandler = getURLStreamHandler(protocol);
+ URLStreamHandler protocolHandler = null;
+ protocol = protocol.toLowerCase();
+ if (! this.protocol.equals(protocol))
+ protocolHandler = getURLStreamHandler(protocol);
// It is an hidden feature of the JDK. If the protocol does not exist,
// we keep the previously initialized protocol.
if (protocolHandler != null)
{
- this.ph = protocolHandler;
- this.protocol = protocol.toLowerCase();
+ this.ph = protocolHandler;
+ this.protocol = protocol;
}
this.host = host;
this.userInfo = userInfo;
signature.asc
Description: This is a digitally signed message part
- Re: Patch: more protocol fun in URL,
Mark Wielaard <=