You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jroitgrund and I just had a wild time with a debugger hooked up to a production service, where it seemed like an equals method was returning false when it should have been true!
On the box, it seemed that the URL object constructed from the same string resulted in a DNS lookup which sometimes returned different IP addresses (because that service was deployed in multiple places).
this meant that occasionally, this would return false:
URLurl1 = newURL("https://something.example.com");
// wait a bit because we tell Java to cache DNS for 20 seconds '-Dsun.net.inetaddr.ttl=20'URLurl2 = newURL("https://something.example.com");
url1.equals(url2); // 🌶🌶🌶 can return false!
What did you want to happen?
We can't change the URL class itself, so I think we should write an errorprone check to prevent bugs like this.
We could ban comparisons of URL.equals URL and also @Value.Immutable fields which are URLs.
The text was updated successfully, but these errors were encountered:
What happened?
@jroitgrund and I just had a wild time with a debugger hooked up to a production service, where it seemed like an
equals
method was returning false when it should have been true!On the box, it seemed that the
URL
object constructed from the same string resulted in a DNS lookup which sometimes returned different IP addresses (because that service was deployed in multiple places).this meant that occasionally, this would return false:
What did you want to happen?
We can't change the URL class itself, so I think we should write an errorprone check to prevent bugs like this.
We could ban comparisons of URL.equals URL and also
@Value.Immutable
fields which are URLs.The text was updated successfully, but these errors were encountered: