Archive for the ‘Networking’ Category
java.net.URL is based on a fancy rule saying that URLs of two hosts are equal as long as they are resolving to the same IP address. It is known to be incompatible with virtual hosting and should not be used.
URL.equals() would consider the URL of this blog (http://javaantipatterns.wordpress.com) to be equal to an URL of any random blog hosted on WordPress – that is obviously not true.
It is recommended to use java.net.URI objects instead.
java.net.URL class is an absolute champion in a number of implemented antipatterns of
hashCode() as well):