Closed GoogleCodeExporter closed 9 years ago
The Equals method has the same problem. These two methods get implicitly
evaluated
by the InMemoryCallbackStore which uses a dictionary for storage.
Original comment by billyz...@yahoo.com
on 3 Aug 2009 at 6:27
Another related issuein the Equals method:
public override bool Equals(object obj)
{
if (obj == null)
return false;
if (obj is OAuthRequestToken) <-- is this correct?? this always returns false!
return false;
return this.Equals((IRequestToken)obj);
}
Original comment by billyz...@yahoo.com
on 3 Aug 2009 at 6:56
Ok, so a little more digging. Basically, checking the Keys property of a
dictionary
for a request token (e.g. what InMemoryCallbackStore does) does not currently
work
at all, even if the tokens are the exact same references!
It has to do with all three of these methods below. Note that I had to comment
out
the bulk of these methods as a workaround to get ContainsKey working. So these
definitely need further review/testing.
public override bool Equals(object obj)
{
return Equals(obj as IRequestToken);
/* commented out by Will
if (obj == null)
return false;
if (obj is OAuthRequestToken)
return false;
return this.Equals((IRequestToken)obj);
*/
}
public bool Equals(IRequestToken other)
{
if (other == null)
return false;
return base.Equals(other);
/* commented out by Will
return this.Token.Equals(other.Token)
&& this.Secret.Equals(other.Secret)
&& this.Status == other.Status
&& this.ConsumerKey.Equals(other.ConsumerKey)
&& this.AssociatedParameters.Equals(other.AssociatedParameters)
&& this.AuthenticatedUser.Equals(other.AuthenticatedUser)
&& Array.Equals(this.Roles, other.Roles);
*/
}
public override int GetHashCode()
{
return base.GetHashCode();
/* commented out by Will
return this.Token.GetHashCode() ^ this.Secret.GetHashCode() ^
this.Status.GetHashCode()
^ this.ConsumerKey.GetHashCode() ^
this.AssociatedParameters.GetHashCode()
^ this.AuthenticatedUser.GetHashCode() ^ this.Roles.GetHashCode();
*/
}
Original comment by billyz...@yahoo.com
on 3 Aug 2009 at 7:13
Fix implemented into trunk.
Original comment by chris.s....@gmail.com
on 4 Aug 2009 at 3:32
Original issue reported on code.google.com by
billyz...@yahoo.com
on 3 Aug 2009 at 6:18