[Mono-bugs] [Bug 78799][Wis] Changed - Missing operator == on Uri class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 1 07:02:28 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jonpryor at vt.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=78799

--- shadow/78799	2006-08-01 06:09:41.000000000 -0400
+++ shadow/78799.tmp.7313	2006-08-01 07:02:28.000000000 -0400
@@ -56,6 +56,22 @@
 				u1.host == u2.host &&
 				u1.port == u2.port &&
 				u1.path == u2.path &&
 				u1.query == u2.query;
 		}
 
+
+------- Additional Comments From jonpryor at vt.edu  2006-08-01 07:02 -------
+Just to point out the obvious, but that version of operator== will
+return false if both u1 and u2 are null, leading to much confusion:
+
+    Uri u1 = null;
+    Uri u2 = null;
+    if (u1 == u2) {/* this had better be true! */}
+
+You should probably stick a:
+
+    if (u1 == u2)
+        return true;
+
+at the beginning of that method (which will catch both the null case
+and optimize the identity case, u1 == u1).


More information about the mono-bugs mailing list