betweenGo

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 ;-)

Eclipse and Java Blog by Michael Scharf: java.net.URL.equals and hashCode make (blocking) Internet connections….


  • Share/Bookmark

Related posts:

  1. java.io.FileNotFoundException for valid URL
  2. JavaScript Invalid Argument in Internet Explorer Only
  3. JSP redirect to another page
  4. Find a class’s runtime origin
  5. Internet Explorer form does not invoke ATG handler

:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!