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.URLStreamHandler


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

Hi list,


I rewrote URLStreamHandler.hostsEqual() to not throw 
UnknownHostException and be conform to SUNs JRE.


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

iD8DBQE+8vnKWSOgCCdjSDsRAonkAJsFpvAXK0yCy+kwO+G+65kD6W6PIQCgjZXd
ljxHXIMUnQ0CmuJpnfy2A8Y=
=4Wd5
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1971
diff -u -b -B -r1.1971 ChangeLog
--- ChangeLog	20 Jun 2003 12:01:50 -0000	1.1971
+++ ChangeLog	20 Jun 2003 12:05:25 -0000
@@ -1,5 +1,10 @@
 2003-06-20  Michael Koch  <konqueror@gmx.de>
 
+	* java/net/URLStreamHandler.java
+	(hostsEqual): Rewritten.
+
+2003-06-20  Michael Koch  <konqueror@gmx.de>
+
 	* gnu/java/nio/MappedByteFileBuffer.java,
 	gnu/java/nio/natMappedByteFileBuffer.cc:
 	Removed
Index: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v
retrieving revision 1.18
diff -u -b -B -r1.18 URLStreamHandler.java
--- java/net/URLStreamHandler.java	8 Jun 2003 22:07:48 -0000	1.18
+++ java/net/URLStreamHandler.java	20 Jun 2003 12:05:25 -0000
@@ -380,12 +380,20 @@
    * @exception UnknownHostException If an unknown host is found
    */
   protected boolean hostsEqual (URL url1, URL url2)
-    throws UnknownHostException
   {
-    InetAddress addr1 = InetAddress.getByName (url1.getHost ());
-    InetAddress addr2 = InetAddress.getByName (url2.getHost ());
+    InetAddress addr1 = getHostAddress (url1);
+    InetAddress addr2 = getHostAddress (url2);
 
+    if (addr1 != null || addr2 != null)
     return addr1.equals (addr2);
+
+    String host1 = url1.getHost();
+    String host2 = url2.getHost();
+    
+    if (host1 != null && host2 != null)
+      return host1.equalsIgnoreCase (host2);
+
+    return host1 == null && host2 == null;
   }
 
   /**

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