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]

FYI: Patch: java.net.URL


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to trunk to rename the member variable 
"handler" to "ph" (protocol handler) of java.net.URL to match 
classpath's implementation of java.net.URL.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE++LP+WSOgCCdjSDsRApriAJ4zylmm9c/qtzXsS86ZONkM9QIB3ACfTLbf
Iq4sMRH5ttOVdQ/lLlqEx50=
=uM0s
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1988
diff -u -b -B -r1.1988 ChangeLog
--- ChangeLog	24 Jun 2003 20:17:26 -0000	1.1988
+++ ChangeLog	24 Jun 2003 20:20:49 -0000
@@ -1,5 +1,13 @@
 2003-06-24  Michael Koch  <konqueror@gmx.de>
 
+	* java/net/URL.java:
+	Renamed "handler" to "ph" in the whole file to match classpaths
+	version.
+	* java/net/URLStreamHandler.java:
+	(equals): Renamed "handler" to "ph".
+
+2003-06-24  Michael Koch  <konqueror@gmx.de>
+
 	* javax/swing/event/AncestorEvent.java,
 	javax/swing/event/HyperlinkEvent.java,
 	javax/swing/event/InternalFrameEvent.java,
Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.21
diff -u -b -B -r1.21 URL.java
--- java/net/URL.java	18 Jun 2003 08:09:48 -0000	1.21
+++ java/net/URL.java	24 Jun 2003 20:20:54 -0000
@@ -147,7 +147,7 @@
   /**
    * The protocol handler in use for this URL
    */
-  transient URLStreamHandler handler;
+  transient URLStreamHandler ph;
 
   /**
    * This a table where we cache protocol handlers to avoid the overhead
@@ -223,24 +223,25 @@
    * @since 1.2
    */
   public URL(String protocol, String host, int port, String file,
-    URLStreamHandler handler) throws MalformedURLException
+	     URLStreamHandler ph)
+    throws MalformedURLException
   {
     if (protocol == null)
       throw new MalformedURLException("null protocol");
     this.protocol = protocol.toLowerCase();
 
-    if (handler != null)
+    if (ph != null)
       {
 	SecurityManager s = System.getSecurityManager();
 	if (s != null)
 	  s.checkPermission (new NetPermission ("specifyStreamHandler"));
 
-        this.handler = handler;
+        this.ph = ph;
       }
     else
-      this.handler = getURLStreamHandler(protocol);
+      this.ph = getURLStreamHandler(protocol);
 
-    if (this.handler == null)
+    if (this.ph == null)
       throw new MalformedURLException (
 		      "Protocol handler not found: " + protocol);
 
@@ -328,7 +329,7 @@
    *
    * @since 1.2
    */
-  public URL(URL context, String spec, URLStreamHandler handler)
+  public URL(URL context, String spec, URLStreamHandler ph)
     throws MalformedURLException
   {
     /* A protocol is defined by the doc as the substring before a ':'
@@ -381,18 +382,18 @@
       throw new
 	  MalformedURLException("Absolute URL required with null context");
 
-    if (handler != null)
+    if (ph != null)
       {
 	SecurityManager s = System.getSecurityManager ();
 	if (s != null)
 	  s.checkPermission (new NetPermission ("specifyStreamHandler"));
 
-        this.handler = handler;
+        this.ph = ph;
       }
     else
-      this.handler = getURLStreamHandler(protocol);
+      this.ph = getURLStreamHandler(protocol);
 
-    if (this.handler == null)
+    if (this.ph == null)
       throw new MalformedURLException("Protocol handler not found: "
 				      + protocol);
 
@@ -400,7 +401,7 @@
     // is to be excluded by passing the 'limit' as the indexOf the '#'
     // if one exists, otherwise pass the end of the string.
     int hashAt = spec.indexOf('#', colon + 1);
-    this.handler.parseURL(this, spec, colon + 1,
+    this.ph.parseURL(this, spec, colon + 1,
 			  hashAt < 0 ? spec.length() : hashAt);
     if (hashAt >= 0)
       ref = spec.substring(hashAt + 1);
@@ -423,7 +424,7 @@
     if (obj == null || ! (obj instanceof URL))
       return false;
 
-    return handler.equals (this, (URL) obj);
+    return ph.equals (this, (URL) obj);
   }
 
   /**
@@ -512,7 +513,7 @@
    */
   public int getDefaultPort()
   {
-    return handler.getDefaultPort();
+    return ph.getDefaultPort();
   }
 
   /**
@@ -566,7 +567,7 @@
     if (hashCode != 0)
       return hashCode;		// Use cached value if available.
     else
-      return handler.hashCode (this);
+      return ph.hashCode (this);
   }
 
   /**
@@ -579,7 +580,7 @@
    */
   public URLConnection openConnection() throws IOException
   {
-    return handler.openConnection(this);
+    return ph.openConnection(this);
   }
 
   /**
@@ -605,7 +606,7 @@
    */
   public boolean sameFile(URL other)
   {
-    return handler.sameFile(this, other);
+    return ph.sameFile(this, other);
   }
 
   /**
@@ -627,7 +628,7 @@
     // 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.handler = getURLStreamHandler(protocol);
+    this.ph = getURLStreamHandler(protocol);
     this.protocol = protocol.toLowerCase();
     this.authority = null;
     this.port = port;
@@ -652,7 +653,7 @@
     // 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.handler = getURLStreamHandler(protocol);
+    this.ph = getURLStreamHandler(protocol);
     this.protocol = protocol.toLowerCase();
     if (userInfo == null)
       this.host = host;
@@ -701,7 +702,7 @@
   public String toExternalForm()
   {
     // Identical to toString().
-    return handler.toExternalForm(this);
+    return ph.toExternalForm(this);
   }
 
   /**
@@ -714,24 +715,24 @@
   public String toString()
   {
     // Identical to toExternalForm().
-    return handler.toExternalForm(this);
+    return ph.toExternalForm(this);
   }
 
   private static synchronized URLStreamHandler
     getURLStreamHandler (String protocol)
   {
-    URLStreamHandler handler;
+    URLStreamHandler ph;
 
     // See if a handler has been cached for this protocol.
-    if ((handler = (URLStreamHandler) handlers.get(protocol)) != null)
-      return handler;
+    if ((ph = (URLStreamHandler) handlers.get(protocol)) != null)
+      return ph;
 
     // If a non-default factory has been set, use it to find the protocol.
     if (factory != null)
-      handler = factory.createURLStreamHandler(protocol);
+      ph = factory.createURLStreamHandler(protocol);
     else if (protocol.equals ("core"))
       {
- 	handler = new gnu.gcj.protocol.core.Handler ();
+ 	ph = new gnu.gcj.protocol.core.Handler ();
       }
     else if (protocol.equals ("file"))
       {
@@ -745,12 +746,12 @@
 	// fix this problem.  If other protocols are required in a
 	// statically linked application they will need to be handled in
 	// the same way as "file".
-	handler = new gnu.gcj.protocol.file.Handler ();
+	ph = new gnu.gcj.protocol.file.Handler ();
       }
 
     // Non-default factory may have returned null or a factory wasn't set.
     // Use the default search algorithm to find a handler for this protocol.
-    if (handler == null)
+    if (ph == null)
       {
 	// Get the list of packages to check and append our default handler
 	// to it, along with the JDK specified default as a last resort.
@@ -767,34 +768,33 @@
 				".Handler";
 	    try
 	      {
-		handler =
-		  (URLStreamHandler) Class.forName(facName).newInstance();
+		ph = (URLStreamHandler) Class.forName(facName).newInstance();
 	      }
 	    catch (Exception e)
 	      {
 		// Can't instantiate; handler still null, go on to next element.
 	      }
-	  } while ((handler == null ||
-		    ! (handler instanceof URLStreamHandler)) &&
+	  } while ((ph == null ||
+		    ! (ph instanceof URLStreamHandler)) &&
 		   pkgPrefix.hasMoreTokens());
       }
 
     // Update the hashtable with the new protocol handler.
-    if (handler != null)
-      if (handler instanceof URLStreamHandler)
-	handlers.put(protocol, handler);
+    if (ph != null)
+      if (ph instanceof URLStreamHandler)
+	handlers.put(protocol, ph);
       else
-	handler = null;
+	ph = null;
 
-    return handler;
+    return ph;
   }
 
   private void readObject(ObjectInputStream ois)
     throws IOException, ClassNotFoundException
   {
     ois.defaultReadObject();
-    this.handler = getURLStreamHandler(protocol);
-    if (this.handler == null)
+    this.ph = getURLStreamHandler(protocol);
+    if (this.ph == null)
       throw new IOException("Handler for protocol " + protocol + " not found");
   }
 
Index: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v
retrieving revision 1.19
diff -u -b -B -r1.19 URLStreamHandler.java
--- java/net/URLStreamHandler.java	20 Jun 2003 12:07:22 -0000	1.19
+++ java/net/URLStreamHandler.java	24 Jun 2003 20:20:54 -0000
@@ -269,10 +269,10 @@
       return false;
     int p1 = url1.getPort ();
     if (p1 == -1)
-      p1 = url1.handler.getDefaultPort ();
+      p1 = url1.ph.getDefaultPort ();
     int p2 = url2.getPort ();
     if (p2 == -1)
-      p2 = url2.handler.getDefaultPort ();
+      p2 = url2.ph.getDefaultPort ();
     if (p1 != p2)
       return false;
     String s1, s2;

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