URL.equals and hashCode make blocking Internet connections
by Frank Kim on Jan.15, 2009, under Java SE
Who knew that something as innocent as java.net.URL.equals and hashCode would make blocking Internet connections?
The javadoc of URL.equals says: “Since hosts comparison requires name resolution, this operation is a blocking operation.”, but who reads the documentation of equals? There is a general contract around equals. Joshua Bloch writes in Effective Java: “Don’t write an equals that relies on unreliable resources” (Chapter 3, page 34). Hey Sun, as far as I know, the Internet is not reliable
![]()
Related posts: