PiRSquared17 / oauth-dot-net

Automatically exported from code.google.com/p/oauth-dot-net
0 stars 0 forks source link

Null NameValueCollection Key throws exception when signing. #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a NVC that contains a null key
2. Pass into OAuthConsumerRequest.GetResource(NVC)
3. Wait for the dreaded NullRef exception

What is the expected output? What do you see instead?

It to send in an empty key, instead I'm seeing an exception

What version of the product are you using? On what operating system?

0.8.1.1

Please provide any additional information below.

I changed the sort to:

// Sort parameters into lexicographic order (by key and value)
@params.Sort(
    (left, right) =>
        {
            var leftKey = left.Key ?? String.Empty;
            var leftValue = left.Value ?? String.Empty;
            var rightKey = right.Key ?? String.Empty;
            var rightValue = right.Value ?? String.Empty;

            return leftKey.Equals(rightKey, StringComparison.Ordinal)
                ? string.Compare(leftValue, rightValue, StringComparison.Ordinal)
                : string.Compare(leftKey, rightKey, StringComparison.Ordinal);
        });

Sorry I could not generate a path file.

Original issue reported on code.google.com by brobert...@groupcommerce.com on 26 Apr 2011 at 11:40