< prev index next >
src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
*** 125,136 ****
* per RFC 1738 no hostname is equivalent to 'localhost'
* i.e. file:///path is equal to file://localhost/path
*/
String s1 = u1.getHost();
String s2 = u2.getHost();
! if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2)))
return true;
! if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1)))
return true;
return super.hostsEqual(u1, u2);
}
}
--- 125,136 ----
* per RFC 1738 no hostname is equivalent to 'localhost'
* i.e. file:///path is equal to file://localhost/path
*/
String s1 = u1.getHost();
String s2 = u2.getHost();
! if ("localhost".equalsIgnoreCase(s1) && (s2 == null || s2.isEmpty()))
return true;
! if ("localhost".equalsIgnoreCase(s2) && (s1 == null || s1.isEmpty()))
return true;
return super.hostsEqual(u1, u2);
}
}
< prev index next >