You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2006/08/03 09:02:25 UTC
svn commit: r428264 -
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
Author: pyang
Date: Thu Aug 3 00:02:24 2006
New Revision: 428264
URL: http://svn.apache.org/viewvc?rev=428264&view=rev
Log:
Fix for HARMONY-1040 ([classlib][luni] java.net.URLStreamHandler.hostEquals should return true when two urls have the same host ip.)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=428264&r1=428263&r2=428264&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java Thu Aug 3 00:02:24 2006
@@ -374,10 +374,17 @@
* <code>false</code> if the hosts are different
*/
protected boolean hostsEqual(URL url1, URL url2) {
- String host1 = url1.getHost(), host2 = url2.getHost();
- return host1 == host2
- || (host1 != null && host1.equalsIgnoreCase(host2));
- }
+ String host1 = url1.getHost(), host2 = url2.getHost();
+ if (host1 == host2 || (host1 != null && host1.equalsIgnoreCase(host2))) {
+ return true;
+ }
+ InetAddress addr1 = getHostAddress(url1);
+ InetAddress addr2 = getHostAddress(url2);
+ if (addr1 == addr2 || (null != addr1 && addr1.equals(addr2))) {
+ return true;
+ }
+ return false;
+ }
/**
* Answers true if the urls refer to the same file. Compares the protocol,